Re: [chrony-users] PPS and NMEA same source not combined

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


Hi Bill,

Chrony.conf copied below, mostly the packaged version with some minor alterations.


# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usable directives.

# Include configuration files found in /etc/chrony/conf.d.
# confdir /etc/chrony/conf.d
allow 192.168.178
# Use Debian vendor zone.
pool 2.debian.pool.ntp.org iburst

# Use time sources from DHCP.
# sourcedir /run/chrony-dhcp

# Use NTP sources found in /etc/chrony/sources.d.
# sourcedir /etc/chrony/sources.d

# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys

# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift

# Save NTS keys and cookies.
ntsdumpdir /var/lib/chrony

# Uncomment the following line to turn logging on.
#log tracking measurements statistics

# Log files location.
logdir /var/log/chrony

# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0

# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync

# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1 3

# Get TAI-UTC offset and leap seconds from the system tz database.
# This directive must be commented out when using time sources serving
# leap-smeared time.
leapsectz right/UTC

refclock SHM 0 refid NMEA 
refclock PPS /dev/pps0 lock NMEA refid PPS

Output from chronyc sources

MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#* NMEA                          0   4   377    16   +311ns[ +316ns] +/-  365ns
#- PPS                           0   4   377    16   +311ns[ +311ns] +/-  365ns
^- 2a02:e00:ffe9:11c::1          4   6   377   159  +5164us[+5164us] +/-   16ms
^- 85.199.214.102                1   7   377    32  +4755us[+4755us] +/-   11ms
^- ntp.nat.ms                    2   7   377    96  +2273us[+2273us] +/-   29ms
^- time.cloudflare.com           3   7   377    28  +3243us[+3243us] +/-   16ms

For some reason it’s now decided to take the NMEA time as primary.  Maybe I should put the precision statement back into the NMEA line as that one has much more latency as you described earlier.  I did previously have precision 1e-1 to get a second accuracy but found it kept preferring the internet time sources then.



 
Kind regards, Michael A Smith.

📲 07973 221971
🏠 24, Fifth Avenue, Portsmouth PO6 3PE UK
📩 mike@xxxxxxxxxxxxxxxxxxxxx
My apologies for any incorrect information or typographical errors. Any opinions expressed are my own, and are not intended to offend. Anyone offended by anything stated, will likely have offended me, by being inconsiderate of my beliefs.
 

On 19 Mar 2023, at 19:13, Bill Unruh <unruh@xxxxxxxxxxxxxx> wrote:

Actually offset not drift (Offset is the actual time difference between your
clock and the true time, drift is the rate at which the offset grows, or
shrinks.

Anyway that is a very minor point. It sounds to me that your nmea is not
working at all, which is why I was asking how you deliver the nmea time to
chrony. What is your /etc/chrony.conf file? Ie, could you show us a copy of your
chrony.conf file?


What does (run as root)
chronyc
sources
actually say? (Ie show us a copy and paste of the output of the sources
output.)



William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____ unruh@xxxxxxxxxxxxxx
Canada V6T 1Z1 ____|____ and Gravity ______|_    theory.physics.ubc.ca/

On Sun, 19 Mar 2023, Mike Smith wrote:

[CAUTION: Non-UBC Email] Bill thanks for explanation of the 300ns, all very clear and no I don’t need
it, it’s an interesting exercise however. :)
My pps and NMEA both come from a gps hat (u-blox M8Q). 
When I found the mega drift I did restart chrony which in effect did nothing to the drift.  So on the
surface it seems to me that NMEA is looking at the second and pps looking at sub second, which did
surprise me a little as I would have expected the NMEA to cover the broadest time and date first
before narrowing down on the second, hence my original question.  
In order to get it all back in sync I had to set the date and then restart chronyd, which shortly
after resulted in a corrected time.  At no point did chronyc sources show me any errors, all very odd.
Thanks for you time and explanations Bill you have help me understand this a lot more that I did a few
days ago.  
Mike
 
Kind regards, Michael A Smith.
📩 mike@xxxxxxxxxxxxxxxxxxxxx
My apologies for any incorrect information or typographical errors. Any opinions expressed are my own,
and are not intended to offend. Anyone offended by anything stated, will likely have offended me, by
being inconsiderate of my beliefs.
 

     On 19 Mar 2023, at 17:26, Bill Unruh <unruh@xxxxxxxxxxxxxx> wrote:

     Whetehr it is actually accurate to 300ns is open to debate. It has no way of
     knowing what the time lag is between the GPS receiver receiving the second
     mark, and the computer actually registring it. Length of the cable from the
     receiver to the computer, time of the computer actually registring the arrival
     of the leading edge of the pulse. Time required to actually read the system
     clock. Those are all places of systematic delays. All chrony can do is to
     measure the random delays and errors, and average them out. That gives the
     300ns. Without another more accurate timing source you cannot test the
     actually accuracy. But I suspect you do not care for that kind of accuracy
     anyway.

     Secondly, are you sure that your nmea actaully works and is delivering the
     time to the computer?If you stop and restart chrony is the time delivered
     approximately right? If you look in the chrony logs, do you see the nmea time
     being delivered to the machine even if it is not selected?

     So what does it say
     chronyd
     sources

     How are you getting the nmea timing?

     William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
     Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
     UBC, Vancouver,BC _|_ Program in Cosmology |____ unruh@xxxxxxxxxxxxxx
     Canada V6T 1Z1 ____|____ and Gravity ______|_    theory.physics.ubc.ca/

     On Sun, 19 Mar 2023, Mike Smith wrote:

           [CAUTION: Non-UBC Email] Well in theory no one has access apart from me, but
           yesterday after I was messing about with it, trying to

           get it all working.  Then I looked in more detail PPS working within 300ns
           wow! but then I looked at the time and date and it was in

           July 2022.  So it was accurate to the second but way out in time and date,
           rather surprised me.  Was all very odd.

            

           [t_7edvEm.jpg?v=45]

           Kind regards, Michael A Smith.

           📲 07973 221971

           🏠 24, Fifth Avenue, Portsmouth PO6 3PE UK

           📩 mike@xxxxxxxxxxxxxxxxxxxxx

           My apologies for any incorrect information or typographical errors. Any
           opinions expressed are my own, and are not intended to

           offend. Anyone offended by anything stated, will likely have offended me, by
           being inconsiderate of my beliefs.

            

                On 19 Mar 2023, at 16:22, Bill Unruh <unruh@xxxxxxxxxxxxxx> wrote:

                On Sun, 19 Mar 2023, Mike Smith wrote:

                      [CAUTION: Non-UBC Email] Ok Bill thanks very much for the
           comprehensive reply, so in effect I am using

                      both effectively by locking my pps against an NMEA, and once it has
           that pps takes over and NMEA

                      ceases to be needed.  So in effect what I am seeing is the correct
           behaviour and I shouldn’t expect

                      anything different.  That’s all great to know, thank you. What
           mitigation can I add for say someone

                Someone? who else has root on your machine? If it is on the net you can
           also

                have other network servers as backups. And nmea is still working I
           suppose.

                And if "someone" can change the date, they can also change your
           chrony.conf

                and remove the PPS, and do alll sorts of damage.

                      changing the date of the machine, as my current method keeps
           seconds accurately but doesn’t seem to

                      test beyond that, so into mins hours and days?  Hope you understand
           my question.

                      Many thanks, Mike.

                       

                      [t_7edvEm.jpg?v=45]

                      Kind regards, Michael A Smith.

                      📲 07973 221971

                      🏠 24, Fifth Avenue, Portsmouth PO6 3PE UK

                      📩 mike@xxxxxxxxxxxxxxxxxxxxx

                      My apologies for any incorrect information or typographical errors.
           Any opinions expressed are my own,

                      and are not intended to offend. Anyone offended by anything stated,
           will likely have offended me, by

                      being inconsiderate of my beliefs.

                       

                           On 19 Mar 2023, at 00:41, Bill Unruh <unruh@xxxxxxxxxxxxxx>
           wrote:

                           NMEA is in general a terrible clock, unless what you want to
           know is "What second is the

                           time at". Delivering an NMEA string takes about 1/10 of a
           second. 9600Bd, with 10 bits per

                           character, and about 100 characters per string.

                           Compare that to PPS which delivers the "top of the second" to
           about 1

                           microsecond, 100000 times better. Ie, nmea and pps are
           completely

                           incomparable. The NMEA is of course critical in telling which
           second it was

                           that tht PPPS pulse was telling you to the microsecond when it
           occured. YOu

                           can tell PPS to use NMEA to find out what second it is (it
           could also use

                           almost any other source on the net as well, but once it has
           done so, it no

                           longer needs it unless something disasterous happens so that
           chrony no longer

                           know what second the signal came in on (eg the computer shut
           down for an hour

                           or more).

                           William G. Unruh __| Canadian Institute for|____ Tel:
           +1(604)822-3273

                           Physics&Astronomy _|___ Advanced Research _|____ Fax:
           +1(604)822-5324

                           UBC, Vancouver,BC _|_ Program in Cosmology |____
           unruh@xxxxxxxxxxxxxx

                           Canada V6T 1Z1 ____|____ and Gravity ______|_
              theory.physics.ubc.ca/

                           On Sat, 18 Mar 2023, Mike Smith wrote:

                                 [CAUTION: Non-UBC Email] Hi, I have a GPS hat working
           fine with a steady nice

                                 long stream of sats.

                                 My chrony conf file has the following refclocks 

                                 refclock PPS /dev/pps0 lock nmea refid PPS

                                 refclock SHM 0 refid NMEA

                                 Chrony eventually chooses my PPS as the current best
           clock as I would have

                                 expected.  Unfortunately the NMEA clock always comes up

                                 with the ? Maybe in error when queried from chronyc
           sources

                                 I can’t see why NMEA should be in error when it’s
           essentially the same source.

                                  Is there something I can do to keep pps as current

                                 best clock and NMEA to be combined?

                                 Sorry if it’s a stupid question

                                 Thanks, Mike.

                                  

                                 Kind regards, Michael A Smith.

                                 📩 mike@xxxxxxxxxxxxxxxxxxxxx

                                 My apologies for any incorrect information or
           typographical errors. Any

                                 opinions expressed are my own, and are not intended to

                                 offend. Anyone offended by anything stated, will likely
           have offended me, by

                                 being inconsiderate of my beliefs.

                                  


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/