From: Michael Kelly Date: Wed, 15 Apr 2026 18:03:09 +0000 (+0100) Subject: hurd: __adjtime() to support NULL delta whilst returning olddelta. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;ds=sidebyside;p=thirdparty%2Fglibc.git hurd: __adjtime() to support NULL delta whilst returning olddelta. 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> --- 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 #include #include +#include /* 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);