1

I am trying to find out the most recent time chrony checked to see if we are in sync. I can see chrony's sources with the following command:

~]$ chronyc sources

210 Number of sources = 3
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* a.b.c                         1   10   377    32m  -8638us[-8930us] +/-  103ms
^- d.e.f                         1   10   366    77m  +2928us[+1960us] +/-  104ms
^+ g.h.i                         2   10   377    403    -14ms[  -14ms] +/-  137ms

The * symbol indicates the server that we synced to, and the + symbol indicates "acceptable" servers. I can see that chrony is indeed polling both a.b.c and g.h.i.

So what I want to know is if I can use the minimum between the two LastRx values as the most recent time that we confirmed we are in sync. In this example we are synced to a.b.c, but 403s < 32m, so does that mean that 403 seconds ago chrony checked against g.h.i and determined we are in sync. In other words, is 403 seconds the last time I know system-time was in sync, or is it 32 minutes ago?

There is some documentation on the chronyc command here: https://chrony.tuxfamily.org/doc/3.5/chronyc.html

  • 1
    Have a look at `chronyc tracking` it provides this field; `Update interval : 1028.5 seconds` (This is the interval between the last two clock updates.) – user3788685 Jul 14 '22 at 15:03
  • I didn't understand the documentation on that one. It says `Update interval: This is the interval between the last two clock updates.` I understood that to mean that's the diff between the last sync and the sync before that. So it's actually the diff between the last sync and the current time? – Aristos Athens Jul 14 '22 at 17:59

1 Answers1

1

Use the command chronyc tracking and in the output there's Ref time (UTC):

Reference ID    : B97DBE39 (prod-ntp-4.ntp4.ps5.canonical.com)
Stratum         : 3
Ref time (UTC)  : Sat Aug 12 14:44:33 2023
System time     : 0.000175581 seconds slow of NTP time
Last offset     : -0.000223673 seconds
RMS offset      : 0.000160186 seconds
Frequency       : 0.528 ppm fast
Residual freq   : +0.000 ppm
Skew            : 0.014 ppm
Root delay      : 0.041114863 seconds
Root dispersion : 0.005161697 seconds
Update interval : 1038.2 seconds
Leap status     : Normal

According to the chronyc man page the Ref time field description is

This is the time (UTC) at which the last measurement from the reference source was processed.

so I think it must be the data you're looking for.

To convert the UTC timestamp to local time you can use e.g. date command:

$ date -d 'Sat Aug 12 14:44:33 2023 UTC'
Sat Aug 12 17:44:33 EEST 2023

(My local time was EEST.)

Tuomas
  • 515
  • 5
  • 11