C 编程语言中的时间戳 [英] Time stamp in the C programming language
本文介绍了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屋!
查看全文