linux - 你如何在 shell 中获取 clock_gettime(2) 时钟?

标签 linux time

我看不到 date 的选项

/proc/uptime 是基于引导的,而不是单调的。

最后我找到了cat/proc/timer_list | grep now 产生的纳秒数是通过 ktime_get 获得的,如果我理解正确的话,它会返回单调时间,但这非常麻烦。

update:返回值必须与clock_gettime

返回值相同

最佳答案

看起来它在 python 3.3 中可用:http://www.python.org/dev/peps/pep-0418/

否则,您可以编写一个小的 C 程序来调用 clock_gettime:http://linux.die.net/man/3/clock_gettime

关于linux - 你如何在 shell 中获取 clock_gettime(2) 时钟?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18490494/

相关文章:

python - python中函数的准确计时

php - 减去 PHP 中的时间即可得到秒数差异

linux - 获取子目录中的最新文件(同名)

java - Java (Linux) 中的文件路径

c - 从信号处理程序终止子进程

c# - TimeZoneInfo 在 2014 年 11 月 2 日美国东部时间凌晨 2 点提前一个小时递增时区

java - JPA 将另一个时间保存到数据库中

windows - Windows 上的 XTerm

c - 如何加载共享库符号以使用 gdb 和 gdbserver 进行远程源代码级调试?

php - 秒到年