标题:GetTickCount
作者:neeme
日期:2016-06-16 21:12
内容:
大家好:
在 win32 + bcb 时, 有个 GetTickCount() 返回第统启动到现在的 tick, 单位 ms.
请问在 Linux + qt5 怎样实现呢? 如果用 QDateTime , 精度只能到秒,而且运行过程中,如果
用户改充了系统时间,就会出错了。
谢谢大家!
#1 [dingcai 06-16 21:54]
用QElapsedTimer。
#2 [realfan 06-16 21:58]
想精度高,可以考虑用c语言中的函数gettimeofday,微秒级精度
#include
int gettimeofday(struct timeval*tv, struct timezone *tz);