You are not logged in.

#1 2015-09-10 16:40:46

e.sovetkin
Member
From: Aachen
Registered: 2013-04-05
Posts: 28

systemd-timesyncd force synchronisation

Hello,

is there, perhaps, a signal which can be sent to timesyncd, so that it would synchronise the time with ntp server? Or is there any other mechanism to force synchronisation at a given time?

Thanks!

Offline

#2 2015-09-10 17:56:21

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: systemd-timesyncd force synchronisation

Why do you want to do that? This seems like an XY Problem

systemd-timesyncd isn't a one-off synchronisation, but keeps polling the NTP server and self-adjusts its polling up and down once synchronised.

Offline

#3 2015-09-10 18:51:21

e.sovetkin
Member
From: Aachen
Registered: 2013-04-05
Posts: 28

Re: systemd-timesyncd force synchronisation

Thanks for the reply!

Yes, perhaps, it is indeed rather a silly matter.

My original problem is that I am trying to estimate a time shift in my quartz watches and for this I need a source of the UTC time. The most reliable way seemed to me to use the laptop synced time. Thus, I measure the shift right after synchronisation (the occurrence of synchronisation I see in log file).

I just don't understand what triggers the synchronisation with ntp server; is it a timed scheduled procedure (like cron), or something triggers it (like updated network).

It is really a silly matter, and sorry for wasting your time.

Offline

#4 2015-09-25 20:01:56

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: systemd-timesyncd force synchronisation

ukhippo wrote:

Why do you want to do that? This seems like an XY Problem

systemd-timesyncd isn't a one-off synchronisation, but keeps polling the NTP server and self-adjusts its polling up and down once synchronised.

It doesn't in my system. Mine synchronizes once per bootup, or when I restart systemd-networkd manually. I would like to know how to get it to resynchronize automatically after time intervals.

Here is a current output. The occasions when it resynchronized are when I manually restarted systemd-networkd:


systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2015-09-21 06:58:24 CDT; 4 days ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 315 (systemd-timesyn)
   Status: "Synchronized to time server 205.133.32.18:123 (2.us.pool.ntp.org)."
   CGroup: /system.slice/systemd-timesyncd.service
           └─315 /usr/lib/systemd/systemd-timesyncd

Sep 22 07:22:20 tim-arch-ssd systemd-timesyncd[315]: Network configuration changed, trying to establish connection.
Sep 22 07:22:20 tim-arch-ssd systemd-timesyncd[315]: Synchronized to time server 205.133.32.18:123 (2.us.pool.ntp.org).
Sep 23 08:43:48 tim-arch-ssd systemd-timesyncd[315]: Network configuration changed, trying to establish connection.
Sep 23 08:43:48 tim-arch-ssd systemd-timesyncd[315]: Synchronized to time server 205.133.32.18:123 (2.us.pool.ntp.org).
Sep 24 06:41:14 tim-arch-ssd systemd-timesyncd[315]: Network configuration changed, trying to establish connection.
Sep 24 06:41:15 tim-arch-ssd systemd-timesyncd[315]: Synchronized to time server 205.133.32.18:123 (2.us.pool.ntp.org).
Sep 25 06:49:11 tim-arch-ssd systemd-timesyncd[315]: Network configuration changed, trying to establish connection.
Sep 25 06:49:11 tim-arch-ssd systemd-timesyncd[315]: Synchronized to time server 205.133.32.18:123 (2.us.pool.ntp.org).
Sep 25 14:42:17 tim-arch-ssd systemd-timesyncd[315]: Network configuration changed, trying to establish connection.
Sep 25 14:42:17 tim-arch-ssd systemd-timesyncd[315]: Synchronized to time server 205.133.32.18:123 (2.us.pool.ntp.org).

Tim

Last edited by ratcheer (2015-09-25 20:02:13)

Offline

#5 2015-09-25 21:00:50

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: systemd-timesyncd force synchronisation

mine synchronises every 34ish minutes (2048s). It doesn't log informational messages after the initial sync, but you can check the last time it synchronised by checking the access/modify/change dates returned by

stat /var/lib/systemd/clock

Offline

#6 2015-09-25 21:44:55

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: systemd-timesyncd force synchronisation

So it does. Thanks, ukhippo!

Tim

Offline

Board footer

Powered by FluxBB