免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2912 | 回复: 3
打印 上一主题 下一主题

请问do_gettimeofday(struct timeval *tv)作用是什么? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-12-29 10:06 |只看该作者 |倒序浏览
是求得当前时钟相对于公元元年0时的秒数吗?

论坛徽章:
0
2 [报告]
发表于 2006-12-29 10:09 |只看该作者
我算出来的时间好像是相对1970年的。。。,有知道的吗?

论坛徽章:
0
3 [报告]
发表于 2006-12-29 10:22 |只看该作者
man 2 time:
time() returns the time since the Epoch (00:00:00 UTC, January 1, 1970), measured in seconds.

man 2 gettimeofday:

       The  functions  gettimeofday() and settimeofday() can get and set the time as well as a time-
       zone.  The tv argument is a struct timeval (as specified  in <sys/time.h>):

         struct timeval {
             time_t      tv_sec;     /* seconds */
             suseconds_t tv_usec;    /* microseconds */
         };

       and gives the number of seconds and microseconds since the Epoch (see time(2)).  The tz argu-
       ment is a struct timezone:

         struct timezone {
             int tz_minuteswest;     /* minutes west of Greenwich */
             int tz_dsttime;         /* type of DST correction */
         };

论坛徽章:
0
4 [报告]
发表于 2006-12-29 10:28 |只看该作者
呵呵,不好意思,就从资料里看了一下没仔细看源码。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP