Linux上的GetTickCount函数
来源:互联网 发布:飞机晚点软件 编辑:程序博客网 时间:2024/05/22 07:51
// 返回自系统开机以来的毫秒数(tick)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
}
int main()
{
struct timespec time1 = { 0, 0 };
clock_gettime(CLOCK_REALTIME, &time1);
printf("CLOCK_REALTIME: %d, %d\n", time1.tv_sec, time1.tv_nsec);
clock_gettime(CLOCK_MONOTONIC, &time1);
printf("CLOCK_MONOTONIC: %d, %d\n", time1.tv_sec, time1.tv_nsec);
clock_gettime(CLOCK_MONOTONIC_RAW, &time1);
printf("CLOCK_MONOTONIC_RAW: %d, %d\n", time1.tv_sec, time1.tv_nsec);
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);
printf("CLOCK_PROCESS_CPUTIME_ID: %d, %d\n", time1.tv_sec,
time1.tv_nsec);
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time1);
printf("CLOCK_THREAD_CPUTIME_ID: %d, %d\n", time1.tv_sec,
time1.tv_nsec);
printf("\n%d\n", time(NULL));
printf("tick count in ms: %ul\n", GetTickCount());
return 0;
}
(原文:http://blog.csdn.net/guang11cheng/article/details/6865992)
- linux上的GetTickCount函数
- linux上的GetTickCount函数
- Linux上的GetTickCount函数
- GetTickCount() 函数的使用
- GetTickCount()函数的陷阱!
- linux下的GetTickCount
- 关于GetTickCount函数的用法
- GetTickCount函数
- GetTickCount函数
- GetTickCount函数
- GetTickCount函数
- GetTickcount函数
- GetTickCount函数
- SetTimer函数和GetTickCount()函数的用法
- SetTimer函数和GetTickCount()函数的用法
- 【总结】GetTickCount() 函数的作用和用法
- GetTickCount() 函数的作用和用法!
- GetTickCount函数计时置0的解决办法
- ubuntu14.04安装QT4.7.4
- 欢迎使用CSDN-markdown编辑器
- 各种距离
- hadoop1.2.1伪集群搭建
- 布局
- Linux上的GetTickCount函数
- <%@ include file="URL" %>
- javascript中this对象的指向问题
- http协议基础知识总结
- texmacs 源码安装
- 【模拟】洛谷 P1003 铺地毯
- 解决Eclipse SVN文件冲突详解
- 对象或库文件“XXX.lib”是使用比创建其他对象所用编译器旧的编译器创建的;请重新生成旧的对象和库
- linux下lz4解压缩的安装包