This is required to obtain the remaining time of day adjustment
without altering the required adjustment. The fix is dependent on
committed revisions to gnumach.
---
 sysdeps/mach/hurd/adjtime.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sysdeps/mach/hurd/adjtime.c b/sysdeps/mach/hurd/adjtime.c
index c25b666a22..482af70008 100644
--- a/sysdeps/mach/hurd/adjtime.c
+++ b/sysdeps/mach/hurd/adjtime.c
@@ -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
@@ -34,8 +35,20 @@ __adjtime (const struct timeval *delta, struct timeval 
*olddelta)
   if (err)
     return __hurd_fail (EPERM);
 
+  if (delta == NULL && olddelta == NULL)
+    return EINVAL;
+
   if (olddelta == NULL)
     olddelta = &dummy;
+  else if (delta == NULL)
+    {
+      /* gnumach will not attempt to update the system time if the
+        specified 'seconds' is out of range. It will still return the
+        olddelta under these circumstances. */
+      dummy.tv_sec = MACH_ADJTIME_SECS_INVALID;
+      dummy.tv_usec = 0;
+      delta = &dummy;
+    }
 
   err = __host_adjust_time (hostpriv,
                            /* `time_value_t' and `struct timeval' are in
-- 
2.47.3


Reply via email to