作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我试图打发时间:
int clock_gettime(clockid_t clk_id, struct timespec *tp)
我对应该输入什么 clk_id
感到困惑。有:
CLOCK_REALTIME
CLOCK_REALTIME_COARSE
CLOCK_MONOTONIC
CLOCK_MONOTONIC_COARSE
CLOCK_MONOTONIC_RAW
CLOCK_BOOTTIME
CLOCK_PROCESS_CPUTIME_ID
CLOCK_THREAD_CPUTIME_ID
它们有什么区别?
最佳答案
这里是一些总结,查看手册页 man clock_gettime
CLOCK_REALTIME identifies the realtime clock for the system.
CLOCK_MONOTONIC identifies a clock that increases at a steady rate
(monotonically).
CLOCK_BOOTTIME identical to CLOCK_MONOTONIC, except it also includes
any time that the system is suspended.
CLOCK_PROCESS_CPUTIME_ID
identifies a per process clock based on tick values.
CLOCK_THREAD_CPUTIME_ID
identifies a per thread clock based on tick values.
关于c - clock_gettime系统调用的clk_id有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56211843/
我是一名优秀的程序员,十分优秀!