gpt4 book ai didi

c - clock_gettime系统调用的clk_id有什么区别

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:32:16 24 4
gpt4 key购买 nike

我试图打发时间:

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com