[hurd, commited 3/3] hurd: __adjtime() to support NULL delta whilst returning olddelta.

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.cvs,gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
From: Michael Kelly <[email protected]>

This is required to obtain the remaining time of day adjustment
without altering the required adjustment.
Message-ID: <[email protected]>
---
 sysdeps/mach/hurd/adjtime.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sysdeps/mach/hurd/adjtime.c b/sysdeps/mach/hurd/adjtime.c
index 9d01533b23..4408b1cff5 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
@@ -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);
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.