比GetTickCount()能更靠谱一点的时钟计时timeGetTime()
2022-01-29
89
0
比GetTickCount()能更靠谱一点的时钟计时,有大佬测试有多大优化吗?
unsigned long get_sys_reference_time()
{ // get the system reference time
#if WINDOWS
return timeGetTime();
#elif MAC
static const double twoRaisedTo32 = 4294967296.;
UnsignedWide ys;
Microseconds(&ys);
double r = ((double)ys.hi * twoRaisedTo32 + (double)ys.lo);
return (unsigned long)(r / 1000.);
#endif
}