Allow running without updating system clock (issue 2322)#2360
Allow running without updating system clock (issue 2322)#2360upmcplanetracker wants to merge 9 commits into
Conversation
Add comments for configuration options regarding time synchronization.
Added update_system_clock parameter to the observer.
Hi, yes, hello, I would like this please. Specifically because over a weekend I have developed a very dodgy interop testing harness of NTP implementations, and when all you care about is the shape of the packets, having multiple NTP clients constantly move the system clock it's a bad time for everyone involved. As part of that, @davidv1992 very quickly and generously made this patch to meet my needs, but I would propose this would be useful for others (for example, |
|
It is a hot, wildfire smoke filled Sunday here in the North Eastern US so I
was just excited for a challenge. Ive been thinking about this for a while
and figured it wouldn't be too hard. (Not like the feature request someone
else asked for to have ntpd-rs update the config without restarting...)
So if the devs like @davidv1992 want to use mine as a base or his patch (or
just delete this PR) I'm fine any which way. It kept me busy today.
…On Sun, Jul 19, 2026, 5:17 PM Sarah ***@***.***> wrote:
*signalsforgranted* left a comment (pendulum-project/ntpd-rs#2360)
<#2360 (comment)>
Unclear if developers truly want to add this function
Hi, yes, hello, I would like this please. Specifically because over a
weekend I have developed a very dodgy interop testing harness
<https://github.com/signalsforgranted/zeitwaage> of NTP implementations,
and when all you care about is the shape of the packets, having multiple
NTP clients constantly move the system clock it's a bad time for everyone
involved. As part of that, @davidv1992 <https://github.com/davidv1992>
very quickly and generously made this patch
<https://github.com/signalsforgranted/zeitwaage/blob/main/implementations/ntpd-rs/0001-Prototype-for-not-touching-the-system-clock.patch>
to meet my needs, but I would propose this would be useful for others (for
example, chronyd has the -x option which similar, which can't have been
put there on a whim).
—
Reply to this email directly, view it on GitHub
<#2360?email_source=notifications&email_token=BUKFPFDIAYLTILS2AGP7KZ35FU3HPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBRG42DANZUGQ32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5017407447>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BUKFPFHJUCC66C6M67PXK335FU3HPAVCNFSNUABFKJSXA33TNF2G64TZHM2DMNRSGQZTEOJQHNEXG43VMU5TIOJSGMZTKNJRGAZKC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/BUKFPFCK4WMNJBXV3WG2B5L5FU3HPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBRG42DANZUGQ32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/BUKFPFAHMSV4GSCC5NCUVWL5FU3HPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBRG42DANZUGQ32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Also would you mind pulling ntpd-rs from my forked repo and building it and seeing if it does what you want it to do. I think that would be important feedback if the devs move forward because if it does what you want it to do then they wouldn't have to make many changes. If what I built doesn't break anything but is worthless for your use case, then that's good for me and the devs to know. I was able to pull and build it on my Ubuntu 26.04 system without much of an issue. Of course, even though 26.04 is new-ish their version of cargo is too old for ntpd-rs so I had to update it first to a newer version. 😄 Sometimes Ubuntu releases are crazy up to date with components at the time of release (like podman), other times they're still using much older versions of things... |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2360 +/- ##
===========================================
- Coverage 81.14% 27.59% -53.56%
===========================================
Files 114 60 -54
Lines 23726 7314 -16412
===========================================
- Hits 19253 2018 -17235
- Misses 4473 5296 +823
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thank you for providing this. We will take a deeper look next week, for now I have approved running the CI. Feel free to already try to resolve those issues, as that will be needed for merging anyway. |
addresses issue 2322. Unclear if developers truly want to add this function, but it was flagged as ok for a PR, so I figured I'd try my hand at it.
tested on Ubuntu 26.04 system on the newest version of ntpd-rs. I got it to compile with cargo 1.97.1.
I ran it as normal and then with the new flag set to true. I was able to see zero writes using strace using a fake time of 01-01-2020 12:00:00 am. it didn't break it running as normal with the correct time (with the flag
update-system-clockset as true or omitted), and it was syncing to time servers per usual, so that's a victory in itself. And when I ran it with the new flag set to false and a fake time (1-1-2020 12:00:00 am) it held that time (and that's when I did the strace writes check).I added
update-system-clock = bool(default true) under[synchronization]as the issue author suggested.When set to false:
The daemon never calls
adjtimex,clock_adjtime,clock_settime, orsettimeofdaywith adjustment flagsThe Kalman filter continues to track offset and frequency normally
ServerTask applies the tracked offset to receive timestamps before building NTP responses, so clients still get corrected time
A config warning is emitted on startup if the option is disabled
This allows running ntpd-rs in environments without
CAP_SYS_TIMEwhile still serving accurate time.I changed these files-
ntpd/src/daemon/config/mod.rsI added config option and validation warningntpd/src/daemon/clock.rsI added a new SoftClock wrapper and TrueTimeClock traitntpd/src/daemon/server.rscauses server responsesuse to_true_time()ntpd/src/daemon/system.rsnow genericspawn()accepts TrueTimeClock boundntpd/src/daemon/observer.rsthis exposessystem_clock_adjustmentin statusntpd/src/daemon/mod.rsthis wires SoftClock into main loop