0208, time1(), time2()
(高顯忠, sjgau4311@gmail.com, 2011-02-08 12:28)
1樓
// time1(&t1);
void time1(int *t1)
{
struct _timeb timebuffer;
int sec, ms;
_ftime( &timebuffer );
sec= timebuffer.time;
ms= timebuffer.millitm;
sec%= (24L*86400);
(*t1)= sec*1000 + ms;
}// end of time1()
// ----------------------------------------------
// time2(t1, &dt);
void time2(int t1, double *dt)
{
int t2;
time1(&t2);
(*dt)= (t2 - t1)/1000.0;
// (*dt) >= 0.0
if ((*dt) < 0.0) {
(*dt)+= (24L*86400);
}
}// end of time2()
// ----------------------------------------------