计算时间相关
来源:互联网 发布:中国人眼睛的颜色 知乎 编辑:程序博客网 时间:2024/05/13 20:57
structtimespec{
__time_ttv_sec; /*seconds 秒*/
longint tv_nsec; /*nanoseconds 纳秒*/
}
与struct timeval 不同,将结构体内成员微秒变换成纳秒
<sys/time.h>:
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
(1) struct--timeval
--------------------------------------------------
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /*microseconds */
};
millisecond 毫秒
microsecond 微秒
timeval表示一个时间点,比如:
timeval.tv_sec = 1 (s)
timevat.tv_usec = 500 000 (μs)
1:500 = 1s500000μs = 1.5s
(2) gettimeofday()
--------------------------------------------------
int gettimeofday(struct timeval *tv, structtimezone *tz);
The functions gettimeofday() and settimeofday() can get and set the timeas well as a timezone.
The use of the timezone structure is obsolete; the tz argument shouldnormally be specified as NULL.
(3) 运行结果:
--------------------------------------------------
time 1181788367:991487
time 1181788369:991602
http://www.ibm.com/developerworks/cn/views/linux/libraryview.jsp?sort_by=&show_abstract=true&show_all=&search_flag=&contentarea_by=Linux&search_by=%E8%BF%9B%E7%A8%8B%E9%97%B4%E9%80%9A%E4%BF%A1&topic_by=-1&type_by=%E6%89%80%E6%9C%89%E7%B1%BB%E5%88%AB&ibm-search=%E6%90%9C%E7%B4%A2
http://www.cnblogs.com/zhiranok/archive/2011/12/22/linux_IPC_latency.html
- 计算时间相关
- MySQL时间计算相关
- 计算时间相关的东东
- DateUtil时间相关计算源码
- sql计算时间的相关操作
- 数据在链路层传播相关时间计算
- java 时间计算 格式化的相关记录(后续)
- oracle相关时间计算,得到季度第一天、最后一天
- 【VBA研究】VBA中日期和时间相关的计算
- 计算两个String 类型的时间相关几个月
- 时间戳 相关计算 保存起来,不想动脑
- 时间计算
- 时间计算
- 计算时间
- 时间计算
- 时间计算
- 时间计算
- 时间计算
- android kernel content
- unix_thr.c
- 汇编的jl/jg与jb/ja--------古魏书生
- java中FOR循环实现累加、四则运算
- 结构体 GC回收 DISpose 字符串拘留池
- 计算时间相关
- 内外双通详解
- 声道
- 【JSTL】标准标签库JSTL
- Goertzel algorithm
- 高性能WEB开发之Web性能测试工具推荐
- iBatis vs Hibernate 比较
- Keso眼中的移动互联网罗生门
- ant Java程序运行的扩展