小编Joh*_*han的帖子

处理系统时间变化

我想知道两个事件发生之间的时间.

现在,简单的方法是使用类似的东西:

time_t x, y;
x = time(NULL);

/* Some other stuff happens */

y = time(NULL);
printf("Time passed: %i", y-x);
Run Code Online (Sandbox Code Playgroud)

但是,系统时间可能会在这两个事件之间发生变化.

有没有另一种方法可以知道两个事件之间的时间?或者有没有办法检测系统时间的变化?

c linux

2
推荐指数
1
解决办法
397
查看次数

标签 统计

c ×1

linux ×1