获取当前时间,以毫秒为单位,在C? [英] Get the current time, in milliseconds, in C?

查看:125
本文介绍了获取当前时间,以毫秒为单位,在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

这篇关于获取当前时间,以毫秒为单位,在C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆