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/

相关文章:

linux - 如何在文本文件中包含带有模式的字符串的行的末尾添加文本?

c++ - 线程取消 (pthread) & C++

linux - 使用 SIGKILL 杀死父进程和子进程

python - 在 Python 中,如何创建 X 小时的日期时间?

linux - 如何在 Hyperledger Fabric 中创建一个新 block

linux - 消除 。从查找的结果

mysql - 时区 America/Los_Angeles 和 US/Pacific 和 PST8PDT 之间的区别?

python - 如何在 pandas 数据框中选择时间段?

c - 查询用户的日期,如果用户按 Enter 键,则使用今天的日期

C程序打印当前时间