unsigned long GetTickCount() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000); } unsigned long timeGetTime() { return GetTickCount(); }
ps:在linux x64下,返回值最好使用unsigned long,unsigned int为32位,在服务器运行超过必定天数以后会溢出,溢出以后数值按期调用仍是递增的,可是会出现溢出波动,这样的问题比较隐蔽。 linux
请不要参考文章:http://blog.csdn.net/wjr2012/article/details/7896619 服务器
unsigned int是一个坑 spa