Re: [chrony-users] Best way to force clock step at shutdown

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



On Tue, 12 Jan 2016, Hector Oron wrote:

Hello,

2016-01-12 17:26 GMT+01:00 Bill Unruh <unruh@xxxxxxxxxxxxxx>:
On Tue, 12 Jan 2016, Hector Oron wrote:

Hello,

 As I read on an old post here:

http://listengine.tuxfamily.org/chrony.tuxfamily.org/chrony-users/2014/10/msg00004.html

 The recommended way to be able to force a sync is to generate a
burst and wait 10 sec for measurements to complete, then do the
stepping on the clock.


This is a sync of your computer's clock to the remote clock. If chrony is
running then that will occur continuously and transparently and without any
steps.

If my clock is set to Mon Nov 23 08:22:48 GMT 2015, chrony does not
seem to be fast to bring it to current actual time, therefore a step
is needed, but the requirement is that it cannot step during computer
activity but at shutdown process.

But why or when would your clock be set to Mon Nov 23? If chrony was running
before you shut it down, and you have an rtc, it will be very close to the
correct time when you switch it on.

And what does it mean "it cannot stop during computer activity" Obviously the
compter must be running to do anything with the clock. What program is it that
is intolerant of stepping? And if you start chrony with chrony -g it will step
when it first comes up, which could be before the program you are concerned
about even starts running.



 My requirements need to sync time only at shutdown, but time cannot
change during machine activity, if I do the burst, sleep, makestep at
shutdown it works, but I would prefer to not have to wait.

I really do not know what this means. Obviously you want your clock on your
computer to keep running while you are using it. You do not want the system
time stuck on midnight all of the time. That would certainly break
everything. But if you run chrony while the system is running, your clock
will not only
run continuously, but will also not step. Its rate will simply be increased
or
decreased until your clock keeps step with the external clock. So you will
need to be more specific with what you really want.

Of course I want clock to behave as a clock and I expect it to tick,
but I have a hard requirement that it cannot step during computer

That makes no sense since the only time the computer can change the clock is
while it is running. It is running during shutdown as well. So the above is
NOT your requirement. Now it may well be that you have a program which you are
running which cannot tolerate a step. What is it? Can you make sure that the
step occurs before that program runs?

Note that as Lichvar says, you could also do a makestep just before you shut
down.

Do you have an rtc (a "hardware clock" which keeps running even when the
computer is switched off?)


activity. In the above case where date is set to Mon Nov 23 08:22:48
GMT 2015, I am trying to force a step at shutdown, so next time
computer gets running, it might have a close enough time to current
actual time.

The computer clock does not run when the computer is shut down. Many computers
have an rtc which does run, but has nothing to do with the system time. Chrony
can read it at bootup to set the system clock. It can also keep track of the
rtc to see how fast/slow it runs or how far off it is. But if your shutdown
services run hwclock to reset the rtc, then that feature of chrony is a but
useless. Note that NOTHING on the computer uses the rtc while the computer is
running. so setting the rtc will not affect anything, except the time at the
next bootup.



 What I am planning to do is to have a systemd unit file that
triggers the burst at machine startup, then does the makestep at
shutdown, that way I believe clock should only step at shutdown


What? why would you do that? It is very unclear what problem you are trying
to
solve, but this does not seem to be the solution to any problem I can think
of. Chrony is NOT like ntpdate. It does not steop the clock each time it
runs.

Miroslav has been of great help to understand what's going on. I am
now testing the following:
* set old time
* reboot machine, expecting NM hooks get source servers online
* wait 17 minutes for chronyd to take measurements
* run makestep

I hope that brings time to current.

Uh, yes, but that will step the clock sometime after about 17 min. You could
also do a burst (burst 3/5 say) and do a makestep. But makestep steps the
clock which you claimed should not happen. I am still very confused.



--
To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject. For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


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