Alex
Alex

Reputation: 36

How to know if htpdate has synchronized system clock?

On my linux system, I use ntp to synchronize the system clock. I also installed htpdate to synchronize it when ntp is not available.

To know if ntp has synchronized the clock, I call timedatectl that outputs :

System clock synchronized: yes

But this "variable" is not changed when its htpdate that changes the system clock.

Is there a similar way to know if htpdate has set the system clock ?

Upvotes: 1

Views: 1120

Answers (1)

Eddy
Eddy

Reputation: 31

htpdate doesn't set the kernel flag used by ntp and timedatectl (yet).

simple way of checking can be done like,

# htpdate example.com
Offset 0.125 seconds

or if your system is in sync, it will return

# htpdate example.com
No time correction needed

Update: in latest master (will be included in version htpdate 1.3.5) the "System clock synchronized: yes" will be set when used with "-x'

https://github.com/twekkel/htpdate

Upvotes: 2

Related Questions