Starting point for CLOCK_MONOTONIC

后端 未结 3 607
名媛妹妹
名媛妹妹 2020-12-09 04:07

As I understand on Linux starting point for CLOCK_MONOTONIC is boot time. In my current work I prefer to use monotonic clock instead of CLOCK_REALTIME

3条回答
  •  时光说笑
    2020-12-09 04:24

    CLOCK_MONOTONIC is generally not affected by any adjustments to system time. For example, if the system clock is adjusted via NTP, CLOCK_MONOTONIC has no way of knowing (nor does it need to).

    For this reason, don't use CLOCK_MONOTONIC if you need human-readable timestamps.

    See Difference between CLOCK_REALTIME and CLOCK_MONOTONIC? for a discussion.

提交回复
热议问题