summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-03-15 12:53:19 +0100
committerLubomir Rintel <lkundrak@v3.sk>2016-03-15 12:53:19 +0100
commitd6c399b1dd38d6f85fee1f255e7c49b7cdc53859 (patch)
treef08383e8e603a223dd0e194a8a0ad3d94d7ea91a
parent93bc9c0294aaa0687708e46777492dbe3aad91f6 (diff)
downloadNetworkManager-d6c399b1dd38d6f85fee1f255e7c49b7cdc53859.tar.gz
systemd: fall back to CLOCK_MONOTONIC
https://github.com/systemd/systemd/pull/2843
-rw-r--r--src/systemd/src/basic/time-util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/systemd/src/basic/time-util.c b/src/systemd/src/basic/time-util.c
index 56ff48a6f0..5b2b2180d8 100644
--- a/src/systemd/src/basic/time-util.c
+++ b/src/systemd/src/basic/time-util.c
@@ -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;