• ntpd keeps calling adjtime when synchronized to local clock

    From rcheaito via questions Mailing List@questions@lists.ntp.org to questions on Mon Nov 3 22:43:00 2025
    From Newsgroup: comp.protocols.time.ntp

    When ntpd is running with the following simple config:

    restrict 127.0.0.1
    server 127.127.1.0

    is it expected that ntpd keeps calling adjtime()?

    My understanding is that in this config type, ntpd runs as server only, and will sync itself to the local clock driver. So, if I am not missing something, the daemon should not try to adjust the local clock that it is synchronizing to.

    Is this a specific behavior with VxWorks (where I am testing ntpd with), or common to all systems?


    0x01d67ad0 ntpdmain +0x6c0: timer ()
    0x01d85968 timer +0x58 : 0x01d7156c ()
    0x01d71698 adj_host_clock+0x164: adj_systime ()
    0x0092eca0 adj_systime +0x254: adjtime ()

    Thanks

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Woolley@david@ex.djwhome.demon.invalid to comp.protocols.time.ntp on Mon Nov 3 23:36:53 2025
    From Newsgroup: comp.protocols.time.ntp

    On 03/11/2025 22:43, rcheaito via questions Mailing List wrote:
    My understanding is that in this config type, ntpd runs as server only, and will sync itself to the local clock driver. So, if I am not missing something,
    the daemon should not try to adjust the local clock that it is synchronizing to.

    It will report a finite stratum, and the frequency and phase adjusted
    system time. Unless the kernel API allows direct setting of the time
    (and if it is using adjtime, rather than adjtimex, that suggest the
    kernel doesn't allow control of the frequency), it will need to
    continuously nudge the kernel time, to keep the effective average
    frequency at the value it was set to before it lost all upstream
    sources, in the same way as it was being controlled when the upstream
    sources were valid.

    What you appear to be suggesting would result in the frequency reverting
    to the one determined by the crystal, but ntpd knows the error in that frequency, immediately before the outage, so can and does correct for
    that error.

    The ntpd time for a machine is always the corrected local time for that machine, so there is no resynchronisation process. What actually
    happens is a change in the metadata.

    Using the local clock pseudo-driver has been superceded by orphan mode,
    as the preferred way of handling this situation.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Woolley@david@ex.djwhome.demon.invalid to comp.protocols.time.ntp on Mon Nov 3 23:37:57 2025
    From Newsgroup: comp.protocols.time.ntp

    On 03/11/2025 23:36, David Woolley wrote:
    allows direct setting of the time

    That should have said "of the frequency".
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harlan Stenn via questions Mailing List@questions@lists.ntp.org to rcheaito on Tue Nov 4 02:13:00 2025
    From Newsgroup: comp.protocols.time.ntp

    On 11/3/2025 1:22 PM, rcheaito (via questions Mailing List) wrote:
    When ntpd is running with the following simple config:

    restrict 127.0.0.1
    server 127.127.1.0

    is it expected that ntpd keeps calling adjtime()?

    Yes.

    Ntpd monitors time from its sources, and adjusts the clock.

    If you're using the LOCAL refclock, ntpd gets the time from the local
    clock. It will discover that this source of time matches the system
    time, so it calls adjtime() with no adjustment needing to be made.

    My understanding is that in this config type, ntpd runs as server only, and will sync itself to the local clock driver. So, if I am not missing something,
    the daemon should not try to adjust the local clock that it is synchronizing to.

    That would be extra code that complicates how things work.

    Is there a compelling reason to add this complication?

    Is this a specific behavior with VxWorks (where I am testing ntpd with), or common to all systems?
    I believe it will be common to all systems.

    And I could be wrong - I've been on the edge of a migraine for more than
    2 weeks' time.

    0x01d67ad0 ntpdmain +0x6c0: timer ()
    0x01d85968 timer +0x58 : 0x01d7156c ()
    0x01d71698 adj_host_clock+0x164: adj_systime ()
    0x0092eca0 adj_systime +0x254: adjtime ()

    Thanks
    Side note - in general, we recommend against using the LOCAL refclock.

    See https://support.ntp.org/Support/ConfiguringLocalRefclocks for more information.
    --
    Harlan Stenn <stenn@ntp.org>
    NTP Project Lead. The NTP Project is part of
    https://www.nwtime.org/ - be a member!

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Dave Hart@davehart@gmail.com to rcheaito on Wed Dec 31 07:13:00 2025
    From Newsgroup: comp.protocols.time.ntp

    --000000000000b8edcd06473a1e91
    Content-Type: text/plain; charset="UTF-8"
    Content-Transfer-Encoding: quoted-printable

    On Mon, Nov 3, 2025 at 22:36=E2=80=AFUTC rcheaito <questions@lists.ntp.org>=
    wrote:

    When ntpd is running with the following simple config:

    restrict 127.0.0.1
    server 127.127.1.0

    is it expected that ntpd keeps calling adjtime()?

    My understanding is that in this config type, ntpd runs as server only, a=
    nd
    will sync itself to the local clock driver. So, if I am not missing something,
    the daemon should not try to adjust the local clock that it is
    synchronizing
    to.


    With apologies for taking so long to reply and the caveat that the local
    clock driver has been deprecated since before I first ran ntpd, so I've
    never used or tested it:

    I believe it is expected behavior. I think you want "disable ntp" to your ntp.conf:

    https://www.ntp.org/documentation/4.2.8-series/ntp.conf/#miscellaneous-opti= ons:~:text=3Dis%20enable.-,ntp,-Enables%20time%20and

    Is this a specific behavior with VxWorks (where I am testing ntpd with), or
    common to all systems?


    All systems, I believe. I'm glad to hear the source code actually works on VxWorks. If someone at Wind River wants to hook me up with a
    VxWorks/Workbench setup for the sole purpose of testing ntpd with the
    VxSim, I could test my changes to ntpd against that platform occasionally.
    I like the idea of ntpd continuing to support as many platforms as
    reasonable, and I'd love to do a little work to reduce the #ifdef
    SYS_VXWORKS forest in the code while doing so, but without the ability to
    test, or someone willing to work with me to do such testing, I am hesitant
    to do that cleanup.

    Cheers,
    Dave Hart

    --000000000000b8edcd06473a1e91
    Content-Type: text/html; charset="UTF-8"
    Content-Transfer-Encoding: quoted-printable

    <div dir=3D"ltr"><div dir=3D"ltr"><div><div class=3D"gmail_default" style= =3D"font-family:&quot;trebuchet ms&quot;,sans-serif"></div></div></div><div=
    class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmai= l_attr">On Mon, Nov 3, 20<font face=3D"arial, sans-serif">25 at <span class= =3D"gmail_default" style=3D""></span>2<span class=3D"gmail_default" style= =3D"">2</span>:36=E2=80=AF<span class=3D"gmail_default" style=3D""></span>U= <span class=3D"gmail_default" style=3D"">TC</span></font> rcheaito &lt;<a h= ref=3D"mailto:questions@lists.ntp.org">questions@lists.ntp.org</a>&gt; wrot= e:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0= .8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When ntpd is = running with the following simple config:<br>

    restrict 127.0.0.1<br>
    server 127.127.1.0<br>

    is it expected that ntpd keeps calling adjtime()?<br>

    My understanding is that in this config type, ntpd runs as server only, and=

    will sync itself to the local clock driver. So, if I am not missing somethi= ng,<br>
    the daemon should not try to adjust the local clock that it is synchronizin= g<br>
    to.<br></blockquote><div><br></div><div><div class=3D"gmail_default" style= =3D"font-family:&quot;trebuchet ms&quot;,sans-serif">With apologies for tak= ing so long to reply and the caveat that the local clock driver has been de= precated since before I first ran ntpd, so I&#39;ve never used or tested it= :</div><div class=3D"gmail_default" style=3D"font-family:&quot;trebuchet ms= &quot;,sans-serif"><br></div><div class=3D"gmail_default" style=3D""><span = style=3D"font-family:&quot;trebuchet ms&quot;,sans-serif">I believe it is e= xpected behavior.=C2=A0 I think you want &quot;</span><font face=3D"monospa= ce">disable ntp</font><font face=3D"trebuchet ms, sans-serif">&quot; to you=
    r ntp.conf:</font></div><div class=3D"gmail_default" style=3D""><font face= =3D"trebuchet ms, sans-serif"><br></font></div><div class=3D"gmail_default"=
    style=3D""><a href=3D"https://www.ntp.org/documentation/4.2.8-series/ntp.c= onf/#miscellaneous-options:~:text=3Dis%20enable.-,ntp,-Enables%20time%20and= ">https://www.ntp.org/documentation/4.2.8-series/ntp.conf/#miscellaneous-op= tions:~:text=3Dis%20enable.-,ntp,-Enables%20time%20and</a><font face=3D"tre= buchet ms, sans-serif"></font></div></div><div><br></div><blockquote class= =3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg= b(204,204,204);padding-left:1ex">
    Is this a specific behavior with VxWorks (where I am testing ntpd with), or=

    common to all systems?<br></blockquote><div><br></div><div class=3D"gmail_d= efault" style=3D""><span style=3D"font-family:&quot;trebuchet ms&quot;,sans= -serif">All systems, I believe.=C2=A0 I&#39;m glad to hear the source code = actually works on VxWorks.=C2=A0 If someone at Wind River wants to hook me =
    up with a VxWorks/Workbench setup for the sole purpose of testing ntpd with=
    the VxSim, I could test my changes to ntpd against that platform occasiona= lly.=C2=A0 I like the idea of ntpd continuing to support as many platforms =
    as reasonable, and I&#39;d love to do a little work to reduce the </span><f= ont face=3D"monospace">#ifdef SYS_VXWORKS</font><font face=3D"trebuchet ms,=
    sans-serif"> forest in the code while doing so, but without the ability to=
    test, or someone willing to work with me to do such testing, I am hesitant=
    to do that cleanup.</font></div><div><br></div></div><div><div dir=3D"ltr"=
    class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"l= tr"><font face=3D"tahoma, sans-serif" color=3D"#666666">Cheers,<br>Dave Har= t</font></div></div></div></div>

    --000000000000b8edcd06473a1e91--

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harlan Stenn via questions Mailing List@questions@lists.ntp.org to Dave Hart on Wed Dec 31 08:58:00 2025
    From Newsgroup: comp.protocols.time.ntp

    On 12/30/2025 11:06 PM, Dave Hart wrote:
    On Mon, Nov 3, 2025 at 22:36rC>UTC rcheaito <questions@lists.ntp.org <mailto:questions@lists.ntp.org>> wrote:

    When ntpd is running with the following simple config:

    restrict 127.0.0.1
    server 127.127.1.0

    is it expected that ntpd keeps calling adjtime()?

    My understanding is that in this config type, ntpd runs as server
    only, and
    will sync itself to the local clock driver. So, if I am not missing
    something,
    the daemon should not try to adjust the local clock that it is
    synchronizing
    to.


    With apologies for taking so long to reply and the caveat that the local clock driver has been deprecated since before I first ran ntpd, so I've never used or tested it:

    I believe it is expected behavior.-a I think you want "disable ntp" to
    your ntp.conf:

    https://www.ntp.org/documentation/4.2.8-series/ntp.conf/#miscellaneous- options:~:text=is%20enable.-,ntp,-Enables%20time%20and <https:// www.ntp.org/documentation/4.2.8-series/ntp.conf/#miscellaneous- options:~:text=is%20enable.-,ntp,-Enables%20time%20and>

    Is this a specific behavior with VxWorks (where I am testing ntpd
    with), or
    common to all systems?


    All systems, I believe.-a I'm glad to hear the source code actually works
    on VxWorks.-a If someone at Wind River wants to hook me up with a VxWorks/Workbench setup for the sole purpose of testing ntpd with the
    VxSim, I could test my changes to ntpd against that platform
    occasionally.

    I've asked before, too. If NTF gets a VxWorks setup, we'll add it to
    our build and development framework.

    I like the idea of ntpd continuing to support as many
    platforms as reasonable,

    Yes.

    and I'd love to do a little work to reduce the
    #ifdef SYS_VXWORKSforest in the code while doing so, but without the
    ability to test, or someone willing to work with me to do such testing,
    I am hesitant to do that cleanup.

    Cheers,
    Dave Hart
    --
    Harlan Stenn <stenn@ntp.org>
    NTP Project Lead. The NTP Project is part of
    https://www.nwtime.org/ - be a member!

    --- Synchronet 3.21a-Linux NewsLink 1.2