在C编程语言时间戳 [英] Time stamp in the C programming language

查看:108
本文介绍了在C编程语言时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何杜绝两次T1和T2,并得到使用C以毫秒为单位的区别?

How do I stamp two times t1 and t2 and get the difference in milliseconds in C?

推荐答案

这会给你在几秒钟+微秒时间

This will give you the time in seconds + microseconds

#include <sys/time.h>
struct timeval tv;
gettimeofday(&tv,NULL);
tv.tv_sec // seconds
tv.tv_usec // microseconds

这篇关于在C编程语言时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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