知識社群登入
位置: AutoCAD開放式教學 > 討論區 > 討論
time1(), time2()
1樓
//   time1(    &t1);
void time1(int *t1)
{
int s1, ms;
struct _timeb timebuffer;
_ftime( &timebuffer );
s1= timebuffer.time;
ms= timebuffer.millitm;
s1%= (1L*24*60*60);
(*t1)= s1*1000 + ms;
}// end of time1()
// --------------------------------------------------------

//   time2(t1, &dt);
void time2(int t1, double *dt)
{
int t2;
time1(&t2);
(*dt)= (t2 - t1)/1000.0;
// must (*dt) >= 0
if ((*dt) < 0.0) {
(*dt)+= (1.0*24*60*60);
}
}// end of time2()
// --------------------------------------------------------