fjl / os-timesync

Check whether NTP time sync is enabled in OS settings
2 stars 5 forks source link

support systemd >= 235 #8

Closed juergenhoetzel closed 6 years ago

juergenhoetzel commented 6 years ago

The output format of timedatectl status changed again.

See: https://github.com/systemd/systemd/commit/3ec530a1890925efe347f739917dd4078c1b1942

Output on my Arch Linux setup:

juergen@samson:~ → timedatectl status
                      Local time: Sa 2017-12-02 11:10:13 CET
                  Universal time: Sa 2017-12-02 10:10:13 UTC
                        RTC time: Sa 2017-12-02 10:10:13
                       Time zone: Europe/Berlin (CET, +0100)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

This is also the cause, why mist complains Deine Computeruhr ist nicht synchronisiert! on startup even tough I use the systemd ntp client.

fjl commented 6 years ago

checkEnabled should check whether synchronisation is 'enabled', but shouldn't verify whether the clock is considered 'synced'. This is important because syncing the clock may take a while and the user shouldn't be warned about enabling time sync when it's already on.

fjl commented 6 years ago

Maybe the string we need to check for is "systemd-timesyncd.service active"?

I hate that timedatectl output changes every two months. Would be nice to find a more future-proof way to check this.

fjl commented 6 years ago

I've added the check for "systemd-timesyncd.service active" in c4c1fab.