]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Common source file change, not directly applicable to open-vm-tools.
authorOliver Kurth <okurth@vmware.com>
Fri, 6 Jul 2018 21:31:55 +0000 (14:31 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 6 Jul 2018 21:31:55 +0000 (14:31 -0700)
Enforce monotonic behavior for the value returned by times() on Mac.

open-vm-tools/lib/system/systemLinux.c

index 5b067bef1ccce7d31d3978fbd516e1875d8e857a..c74d48901d9993821f811cf857f91c05b09ca691 100644 (file)
@@ -162,11 +162,13 @@ System_GetTimeMonotonic(void)
 
    return base + (last = current);
 #else  // VM_X86_64
-#ifdef sun
-   /* Solaris has a bug where times() can return a lower value than in
-    * a previous call, see bug #1710952, so we make sure to never
-    * return a lower value, by saving the old value and compare.
-    * We also make that thread safe. */
+#if defined sun || defined __APPLE__
+   /*
+    * PR 1710952 and PR 2136820
+    * times() on Solaris & Mac can return a lower value than the
+    * one in a previous call. As a workaround, we return the last
+    * cached value when we get a lower value from times().
+    */
    static Atomic_uint64 last = { 0 };
 
    while (1) {