aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Harry Sintonen <sintonen@iki.fi>2021-10-21 16:43:41 +0300
committerGravatar Harry Sintonen <sintonen@iki.fi>2021-10-21 16:43:41 +0300
commit87fd565268c5498409d81584b34467bd7e16a81f (patch)
tree4b3d3c8dc07fc1f55053f02f407c389eb2d4ab05 /src
parent57b97a4c910e3294b1ed441acea55da2f9ca3cb1 (diff)
Only use CLOCK_MONOTONIC_RAW with __APPLE__ systems.
Diffstat (limited to 'src')
-rw-r--r--src/util/timestamp.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/timestamp.cc b/src/util/timestamp.cc
index a50f734..59a833f 100644
--- a/src/util/timestamp.cc
+++ b/src/util/timestamp.cc
@@ -48,7 +48,11 @@
#include <stdio.h>
#endif
-#ifdef CLOCK_MONOTONIC_RAW
+// On Apple systems CLOCK_MONOTONIC is unfortunately able to go
+// backwards in time. This breaks mosh when system is returning from
+// suspend as described in ticket #1014. To avoid this issue prefer
+// CLOCK_MONOTONIC_RAW on Apple systems when available.
+#if defined(__APPLE__) && defined(CLOCK_MONOTONIC_RAW)
#define CLOCKTYPE CLOCK_MONOTONIC_RAW
#else
#define CLOCKTYPE CLOCK_MONOTONIC