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位,在服务器运行超过一定天数之后会溢出,溢出之后数值定期调用还是递增的,但是会出现溢出波动,这样的问题比较隐蔽。
请不要参考文章:http://blog.youkuaiyun.com/wjr2012/article/details/7896619
unsigned int是一个坑