This is required to obtain the remaining time of day adjustment
without altering the required adjustment.
---
 sysdeps/mach/hurd/adjtime.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sysdeps/mach/hurd/adjtime.c b/sysdeps/mach/hurd/adjtime.c
index e9c0851daa..413463087a 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
@@ -43,7 +44,17 @@ __adjtime (const struct timeval *delta, struct timeval 
*olddelta)
       rpc_delta.seconds += (delta->tv_usec / TIME_MICROS_MAX);
     }
   else
+#ifdef MACH_ADJTIME_SECS_MAX
+    {
+      /* 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. */
+      rpc_delta.seconds = MACH_ADJTIME_SECS_MAX + 1;
+      rpc_delta.microseconds = 0;
+    }
+#else
     return EINVAL;
+#endif
 
   err = __host_adjust_time (hostpriv, rpc_delta, &rpc_olddelta);
   __mach_port_deallocate (__mach_task_self (), hostpriv);
-- 
2.47.3


Reply via email to