linux - date命令会影响gettimeofday()的结果吗?

标签 linux time

通常,我们调用函数gettimeofday 来获取系统的当前时间。 如果用户使用 date 命令更改时钟会发生什么? 它是否影响函数 gettimeofday 的结果?

最佳答案

参见 here :

The time returned by gettimeofday() is affected by discontinuous jumps in the system time (e.g., if the system administrator manually changes the system time). If you need a monotonically increasing clock, see clock_gettime(2).

所以,是的,它是。

关于linux - date命令会影响gettimeofday()的结果吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37135197/

相关文章:

c++ - 在 clock_gettime() 中使用 _COARSE 变体仍然调用 sys_clock_gettime() 系统调用

android - 如何在 Android 的 UI 屏幕上显示耗时

mysql - 如何添加时间到日期

linux - 如何检查两个 Linux 服务器之间的端口是否打开?

linux - 像 exec() 这样的东西在 Perl 中返回一个值?

linux - 在 redhat RHEL5 上安装 svn 客户端

performance - 使用 WINdows PowerShell 1.0 或 2.0 评估可执行文件的性能

c - vfscanf.c 警告 : the scanf functions add several kilobytes of bloat

c - 如何在 C - uclibc、Linux、mips 中找到动态和静态指针指向的分配大小?

bash - 从单个客户端上的 shell 脚本创建/更新到 NFS 安装的文件中的随机损坏