![]() |
|
Message-ID: <20250710124023.24838-1-jan.kardell@telliq.com> Date: Thu, 10 Jul 2025 14:38:50 +0200 From: Jan Kardell <jan.kardell@...liq.com> To: Rich Felker <dalias@...ifal.cx> Cc: musl@...ts.openwall.com Subject: [PATCH v2] adjtime: Get the remaining adjustment when no new adjustment is set adjtime should should always return the remaining adjustment to the out parameter if out is not NULL. Currently it do so only if a new adjustment is set, i.e. the in parameter is not NULL. To get the time adjustment offset from adjtimex, modes must be set to either ADJ_OFFSET_SS_READ, to just get the offset, or ADJ_OFFSET_SINGLESHOT to set a new offset and return the old remaining offset. To fix getting the remaining adjustment from adjtime when the in parameter is NULL, set modes to ADJ_OFFSET_SS_READ in that case. Signed-off-by: Jan Kardell <jan.kardell@...liq.com> --- Change Log: v1 -> v2: - Update commit message --- 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.