![]() |
|
Message-ID: <20250708160639.GM1827@brightrain.aerifal.cx> Date: Tue, 8 Jul 2025 12:06:40 -0400 From: Rich Felker <dalias@...ifal.cx> To: Jan Kardell <jan.kardell@...liq.com> Cc: musl@...ts.openwall.com Subject: Re: [PATCH] adjtime: Get the remaining diff when no new diff is set On Tue, Jul 08, 2025 at 11:23:49AM +0200, Jan Kardell wrote: > 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 It's not clear to me that the logic here is correct. Isn't adjtime supposed to produde a readback result even when setting the adjustment? Commit message explanation of the change should also be in terms of contracts of adjtime and adjtimex, not any syscalls which the implementation of adjtime is not using (it's only using the public contract of adjtimex), and should identify what adjtime was doing wrong before (failure to return a meaningful value in *out, I think) and how the change fixes that. Rich
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.