mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 04:10:14 +01:00
systemd: fall back to CLOCK_MONOTONIC
https://github.com/systemd/systemd/pull/2843
This commit is contained in:
parent
93bc9c0294
commit
d6c399b1dd
1 changed files with 5 additions and 2 deletions
|
|
@ -49,12 +49,15 @@ static clockid_t map_clock_id(clockid_t c) {
|
|||
/* Some more exotic archs (s390, ppc, …) lack the "ALARM" flavour of the clocks. Thus, clock_gettime() will
|
||||
* fail for them. Since they are essentially the same as their non-ALARM pendants (their only difference is
|
||||
* when timers are set on them), let's just map them accordingly. This way, we can get the correct time even on
|
||||
* those archs. */
|
||||
* those archs.
|
||||
*
|
||||
* Also, older kernels don't support CLOCK_BOOTTIME: fall back to CLOCK_MONOTONIC. */
|
||||
|
||||
switch (c) {
|
||||
|
||||
case CLOCK_BOOTTIME:
|
||||
case CLOCK_BOOTTIME_ALARM:
|
||||
return CLOCK_BOOTTIME;
|
||||
return clock_boottime_or_monotonic ();
|
||||
|
||||
case CLOCK_REALTIME_ALARM:
|
||||
return CLOCK_REALTIME;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue