As reported in D2726 there is currently an issue with random slowdowns and speedups with AMD Ryzen CPUs. The former patch took care of windows and this one is for linux.
According to StackOverflow
```
CLOCK_REALTIME represents the machine's best-guess as to the current wall-clock, time-of-day time. As Ignacio and MarkR say, this means that CLOCK_REALTIME can jump forwards and backwards as the system time-of-day clock is changed, including by NTP.
CLOCK_MONOTONIC represents the absolute elapsed wall-clock time since some arbitrary, fixed point in the past. It isn't affected by changes in the system time-of-day clock.
If you want to compute the elapsed time between two events observed on the one machine without an intervening reboot, CLOCK_MONOTONIC is the best option.
Note that on Linux, CLOCK_MONOTONIC does not measure time spent in suspend, although by the POSIX definition it should. You can use the Linux-specific CLOCK_BOOTTIME for a monotonic clock that keeps running during suspend.
```
Since we only care about elapsed time, MONOTONIC should have been the initial choice. If supported, one might also want to use MONOTONIC_RA0W
According to janwas:
```
Stan:
I'm trying to see if replacing ```cpp (void)
CLOCK_REALTIME represents the machine's best-guess as to the current wall-clock_get, time(CLOCK_REALTIME,-of-day time. &start); ``` by ```cpp (void)clock_gettime(CLOCK_MONOTONICAs Ignacio and MarkR say, this means that CLOCK_REALTIME can jump forwards and backwards as the system time-of-day clock is changed, &start);including by NTP.
CLOCK_MONOTONIC represents the absolute elapsed wall-clock time since some arbitrary, ``` will workfixed point in the past. ## janwas: yeah monotonic is better than realtime.It isn't affected by changes in the system time-of-day clock.
If you want to compute the elapsed time between two events observed on the one machine without an intervening reboot, there's also monotonic_raw which skips NTP freq adjustmentsCLOCK_MONOTONIC is the best option.
Note that on Linux, not sure that's better for long-running sessions.CLOCK_MONOTONIC does not measure time spent in suspend, ## Stan` Since people usually play 10hours session,although by the POSIX definition it should. I guess not :D I hope that will fix it cause I have no idea else.You can use the Linux-specific CLOCK_BOOTTIME for a monotonic clock that keeps running during suspend.
```