QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 776|回复: 4

How to get precise time in C?

[复制链接]
发表于 2003-9-23 09:58:25 | 显示全部楼层 |阅读模式
On my com, i could only get time precise up to second using standard time.h. does anybody know how to get time up to ms?
Thx
发表于 2003-9-24 11:46:39 | 显示全部楼层
gettimeofday can get precise time for microseconds , i don't know this is useful for u com

#include <sys/time.h>

int gettimeofday(struct timeval *tv, struct timezone *tz);
回复

使用道具 举报

发表于 2003-9-24 11:47:09 | 显示全部楼层
把你得到的second乘以1000不行吗?
回复

使用道具 举报

 楼主| 发表于 2003-9-24 12:04:00 | 显示全部楼层
second*1000 will still give presiton up to 1000. i've tried that.
is "sys/time.h" standard labrary? thx.
回复

使用道具 举报

发表于 2003-9-24 16:44:37 | 显示全部楼层
I referenced this function  from linux,  in other os ,you can man gettimeofday
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-14 11:21 , Processed in 0.071982 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表