获取当前时间,以毫秒为单位,在C?
问题描述:
什么是等价 System.currentTimeMillis的()
的Java的使用C?
What is the equivalence of the Java's System.currentTimeMillis()
in C?
答
检查 time.h中
,也许有点像函数gettimeofday()
功能。
Check time.h
, perhaps something like the gettimeofday()
function.
您可以不喜欢
struct timeval now;
gettimeofday(&now, NULL);
然后你就可以从得到的值中提取时间 now.tv_sec
和 now.tv_usec
。