Skip to content

vlc_thread: clarify the documentation about ticks on suspended machines

Steve Lhomme requested to merge robUx4/vlc:tick-now-suspend into master

Based on the Linux CLOCK_MONOTONIC definition [1] the monotonic clock does not count ticks when the system is suspended.

https://www.man7.org/linux/man-pages/man3/clock_gettime.3.html

The POSIX definition of CLOCK_MONOTONIC does not mention if it should increase or not during suspend. Not sure if macOS or xxxBSD made the same choice as Linux. Apparently on some BSD (in this case macOS) it seems to be the other way around: https://www.manpagez.com/man/3/clock_gettime_nsec_np/

     CLOCK_MONOTONIC    clock that increments monotonically, tracking the time
                        since an arbitrary point, and will continue to incre-
                        ment while the system is asleep.

The proper value to use should be

     CLOCK_UPTIME_RAW   clock that increments monotonically, in the same man-
                        ner as CLOCK_MONOTONIC_RAW, but that does not incre-
                        ment while the system is asleep.  The returned value
                        is identical to the result of mach_absolute_time()
                        after the appropriate mach_timebase conversion is
                        applied.

On Windows we have clock sources that vary during suspend, and some that don't.


v2:

  • added the same clarification for libvlc_clock()
  • rebased on master to get faster snap builds
Edited by Steve Lhomme

Merge request reports