]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: __adjtime() to support NULL delta whilst returning olddelta.
authorMichael Kelly <mike@weatherwax.co.uk>
Wed, 15 Apr 2026 18:03:09 +0000 (19:03 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 15 Apr 2026 20:22:11 +0000 (22:22 +0200)
This is required to obtain the remaining time of day adjustment
without altering the required adjustment.
Message-ID: <20260415180318.109742-4-mike@weatherwax.co.uk>

sysdeps/mach/hurd/adjtime.c

index 9d01533b23ff25b2fc2fccc44a00e9c04d9a079f..4408b1cff5b0ddf0ffaa062d2615a4a81c928a87 100644 (file)
@@ -18,6 +18,7 @@
 #include <errno.h>
 #include <sys/time.h>
 #include <hurd.h>
+#include <mach/time_value.h>
 
 /* Adjust the current time of day by the amount in DELTA.
    If OLDDELTA is not NULL, it is filled in with the amount
@@ -44,7 +45,18 @@ __adjtime (const struct timeval *delta, struct timeval *olddelta)
       rpc_delta.microseconds = delta->tv_usec;
     }
   else
+#ifdef MACH_ADJTIME_USECS_OMIT
+    {
+      /* gnumach will not attempt to update the system time if the
+        specified 'microseconds' is specifically
+        MACH_ADJTIME_USECS_OMIT. It will still return the olddelta
+        under these circumstances. */
+      rpc_delta.seconds = 0;
+      rpc_delta.microseconds = MACH_ADJTIME_USECS_OMIT;
+    }
+#else
     return EINVAL;
+#endif
 
   err = __host_adjust_time (hostpriv, rpc_delta, &rpc_olddelta);
   __mach_port_deallocate (__mach_task_self (), hostpriv);