Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250708092349.7647-1-jan.kardell@telliq.com>
Date: Tue,  8 Jul 2025 11:23:49 +0200
From: Jan Kardell <jan.kardell@...liq.com>
To: musl@...ts.openwall.com
Cc: Rich Felker <dalias@...ifal.cx>
Subject: [PATCH] adjtime: Get the remaining diff when no new diff is set

The linux clock_adjtime64 syscall do not return a time offset when
called with modes=0. To get the offset, modes must be set to
ADJ_OFFSET_SS_READ.

Signed-off-by: Jan Kardell <jan.kardell@...liq.com>
---
 src/linux/adjtime.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/linux/adjtime.c b/src/linux/adjtime.c
index 5a707f2f..65d5fe87 100644
--- a/src/linux/adjtime.c
+++ b/src/linux/adjtime.c
@@ -14,7 +14,8 @@ int adjtime(const struct timeval *in, struct timeval *out)
 		}
 		tx.offset = in->tv_sec*1000000 + in->tv_usec;
 		tx.modes = ADJ_OFFSET_SINGLESHOT;
-	}
+	} else
+		tx.modes = ADJ_OFFSET_SS_READ;
 	if (adjtimex(&tx) < 0) return -1;
 	if (out) {
 		out->tv_sec = tx.offset / 1000000;
-- 
2.43.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.