Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[請益] C/C++ elapsed time..

0 views
Skip to first unread message

�i�i

unread,
Nov 23, 2009, 5:06:57 AM11/23/09
to


�b�����Wgoogle�@�}�l�F

�ܦhforum�]��������D

����Q��clock()�������t�O �p��elapsed time

�ڪ��}�o���x��VC++ (�bwindowsXP�W�])

��O�o�쪺�ƭȳ��O�s

�L�k�ϭp��ɶ������� millisec(ms)

#include <ctime> //time.h

�@�몺�覡��:

double diffclock(clock_t clk, clock_t clk_end)
{
double diffticks = clk_end - clk;
double diffms = (diffticks*1000)/CLOCKS_PER_SEC;
return diffms;
}

// clk, clk_end���O���Q�n�q��elapsed time���{����q������


��O���G���O0

time_t�Pclock_t ���G�ۦP�A

�����ϥ�
time_t start, end;
time(&start);
// �{����q
time(&end);

double dif = difftime(end, start);

�]�L�k��oelapsed time.

�Q�аݪO�W�j�̡A���S���J�L�o�˪����D�B�p��ѨM�O?

�P�¦U��~"~

--
�� �o�H��: �����~�{(ptt.cc)
�� From: 140.113.184.224

0 new messages