From: Keno Goertz <contact@kenogo.org>
To: linux-kernel@vger.kernel.org
Subject: ntp: Adjustment of time_maxerror with 500ppm instead of 15ppm
Date: Wed, 7 May 2025 11:15:12 +0200 [thread overview]
Message-ID: <fed2cedc-0458-4dfe-9e14-6d64be618165@kenogo.org> (raw)
Hello,
I've been looking into the kernel's NTP code and found what I understand
to be a deviation from NTP as standardized by RFC 5905. The
documentation of this part of the kernel is pretty sparse, so there may
be some motivation behind this that I don't know of. Perhaps someone
with more knowledge can explain this.
The doc string of `struct ntp_data` states that `time_maxerror` holds
the "NTP sync distance (NTP dispersion + delay / 2)".
ntpd indeed sets this value to what RFC 5905 calls the "root
synchronization distance" LAMBDA.
In RFC 5905, this LAMBDA increases over time because the root dispersion
increases at a rate of PHI, which is set to 15ppm. Running
$ ntpq -c "rv 0 rootdisp"
a couple of times confirms that the root dispersion reported by ntpd
increases with this rate. Consequently, so does the root
synchronization distance LAMBDA.
However, the function `ntp.c:second_overflow()` instead increases the
value of `time_maxerror` with the rate MAXFREQ, which is set to 500ppm.
This leads to standard library functions like ntp_gettime() reporting
much bigger values of `maxerror` than ntpd is working with. This can be
confirmed by running
$ adjtimex -p
a couple of times.
MAXFREQ *can* be found in the reference implementation of RFC 5905 and
is also set to 500ppm there, but it is used in a different context:
MAXFREQ is an upper bound for the local clock's frequency offset, while
PHI is an upper bound for the frequency drift of a clock synchronized
with NTP.
At least this is my understanding. Can someone explain this?
Best regards
Keno
next reply other threads:[~2025-05-07 9:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 9:15 Keno Goertz [this message]
2025-05-07 11:28 Keno Goertz
2025-05-08 19:45 ` John Stultz
2025-05-09 19:40 ` Keno Goertz
2025-05-09 19:49 ` John Stultz
2025-05-12 8:57 ` Miroslav Lichvar
2025-05-14 10:01 ` Keno Goertz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fed2cedc-0458-4dfe-9e14-6d64be618165@kenogo.org \
--to=contact@kenogo.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®