Re: [chrony-users] Getting chrony status

2016-08-09 Thread Miroslav Lichvar
On Tue, Aug 09, 2016 at 09:47:28AM +0200, Mauro Condarelli wrote:
> Il 08/08/2016 10:34, Miroslav Lichvar ha scritto:
> > "time has settled down", you might need to check also the "System
> Problem is on target I have unreliable Internet connection.
> This means i might not have connection at all at boot-time.
> In this condition it's ok to rely on RTC alone.
> What I need is to be sure chronyc did require initializations (e.g.: it did 
> set system clock from RTC) even if not fully synchronized.

If you need to wait for "chronyd -s" to set the system clock from the
RTC, just wait until the foreground chronyd process exits. If it's
started from an init script (or systemd service with Type=Forking),
the clock will be already set when the service is ready. It takes
couple seconds.

> > http://chrony.tuxfamily.org/doc/2.4/chronyc.html#waitsync
> How does that behave in case of disconnected target?

The leap status, which waitsync checks, is set only when synchronized
to a real time source (NTP or refclock), so it will wait forever or
timeout if the maximum number of tries is set.

> I also have a very strange and annoying behavior I need to debug, somehow:
> It happens (rarely, about once in a few days) system time, as seen using 
> either "date" or "time(null)", "jumps around" for a short while and then 
> resets to normal.
> I mean I have record of time going in the past (two days), then in the future 
>  (> one month) then in the past again (>one week) and finally going back to 
> "right" time.
> I spotted this because my target (embedded ARM) has a display that, when 
> idle, just displays system time (fetched using "time(null)"), I casually 
> spotted the bogus time and confirmed this was not a problem with my 
> application by connecting to console and issuing several "date" commands.
> 
> Real question is:
> How do I debug such situation?
> Should I see something on log? (I didn't spot anything suspicious)
> How can I tell chrony to log any correction done to sysclock?

If you enable the "tracking" log, it will contain all corrections from
NTP sources and reference clocks. The initial correction from the RTC
with the -s option is only logged to the system log and there should
be at most one step and one slew per start. If you see more steps when
no NTP sources are available, it's probably something else messing
with the clock.

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Getting chrony status

2016-08-09 Thread Mauro Condarelli

Thanks Miroslav.
Comments below.

Il 08/08/2016 10:34, Miroslav Lichvar ha scritto:

On Sun, Aug 07, 2016 at 05:06:46AM +0200, Mauro Condarelli wrote:

Thanks Steve.
I know about "chronyc tracking", but that is human-readable info.
I need to parse it (in a shell script) to delay starting of my app until time 
has settled down.
Is it enough to wait for "Leap status" to go to "Normal"?
... or should I take into consideration other values?.

Depending on how chronyd is configured and what exactly you mean by

My current /etc/chrony .conf is:
-
server 0.it.pool.ntp.org
server 1.it.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org

logdir /var/log/chrony
log rtc statistics measurements tracking
logchange 1
driftfile /var/lib/chrony/drift
keyfile /etc/chrony.keys
generatecommandkey
makestep 1.0 3
maxupdateskew 100.0
dumponexit
dumpdir /var/lib/chrony
rtconutc
rtcfile /var/lib/chrony/rtc
bindcmdaddress /var/run/chrony/chronyd.sock

rtcdevice /dev/rtc0
-

"time has settled down", you might need to check also the "System

Problem is on target I have unreliable Internet connection.
This means i might not have connection at all at boot-time.
In this condition it's ok to rely on RTC alone.
What I need is to be sure chronyc did require initializations (e.g.: it did set 
system clock from RTC) even if not fully synchronized.

time" and "Skew" values.

The chronyc waitsync command can do all this for you.

http://chrony.tuxfamily.org/doc/2.4/chronyc.html#waitsync

How does that behave in case of disconnected target?



I also have a very strange and annoying behavior I need to debug, somehow:
It happens (rarely, about once in a few days) system time, as seen using either "date" or 
"time(null)", "jumps around" for a short while and then resets to normal.
I mean I have record of time going in the past (two days), then in the future  (> one month) 
then in the past again (>one week) and finally going back to "right" time.
I spotted this because my target (embedded ARM) has a display that, when idle, just displays system 
time (fetched using "time(null)"), I casually spotted the bogus time and confirmed 
this was not a problem with my application by connecting to console and issuing several 
"date" commands.

Real question is:
How do I debug such situation?
Should I see something on log? (I didn't spot anything suspicious)
How can I tell chrony to log any correction done to sysclock?

TiA

--
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.

Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Getting chrony status

2016-08-09 Thread Bill Unruh



I also have a very strange and annoying behavior I need to debug, somehow:
It happens (rarely, about once in a few days) system time, as seen using 
either "date" or "time(null)", "jumps around" for a short while and then 
resets to normal.
I mean I have record of time going in the past (two days), then in the future 
(> one month) then in the past again (>one week) and finally going back to 
"right" time.


Uh, that certainly should not happen, and that should be reflected in all the
log files. Have you looked at the "measurements" log and seen the time
jumping? Is it one of the pool servers or a few or all of them? (the latter
might suggest that there is some program resetting the time for you that you
are running.)

I spotted this because my target (embedded ARM) has a display that, when 
idle, just displays system time (fetched using "time(null)"), I casually


What is "time(null)"? Are you sure that your program for displaying the time
is not screwed up?

spotted the bogus time and confirmed this was not a problem with my 
application by connecting to console and issuing several "date" commands.


Real question is:
How do I debug such situation?


You start with the logs. What is the behaviour of "measurements" around that
time. What is the behaviour of the other logs around that time.


Should I see something on log? (I didn't spot anything suspicious)
How can I tell chrony to log any correction done to sysclock?


What does that mean? It does log steps, which is what this sounds like.



TiA

--
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org with 
"unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org with "help" in the 
subject.

Trouble?  Email listmas...@chrony.tuxfamily.org.



--
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.

Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Getting chrony status

2016-08-08 Thread Miroslav Lichvar
On Sun, Aug 07, 2016 at 05:06:46AM +0200, Mauro Condarelli wrote:
> Thanks Steve.
> I know about "chronyc tracking", but that is human-readable info.
> I need to parse it (in a shell script) to delay starting of my app until time 
> has settled down.
> Is it enough to wait for "Leap status" to go to "Normal"?
> ... or should I take into consideration other values?.

Depending on how chronyd is configured and what exactly you mean by
"time has settled down", you might need to check also the "System
time" and "Skew" values.

The chronyc waitsync command can do all this for you.

http://chrony.tuxfamily.org/doc/2.4/chronyc.html#waitsync

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Getting chrony status

2016-08-07 Thread Mauro Condarelli

Thanks Steve.
I know about "chronyc tracking", but that is human-readable info.
I need to parse it (in a shell script) to delay starting of my app until time 
has settled down.
Is it enough to wait for "Leap status" to go to "Normal"?
... or should I take into consideration other values?.

typical output at startup is:

/ # chronyc tracking

Reference ID: 0.0.0.0 ()

Stratum : 0

Ref time (UTC)  : Thu Jan  1 00:00:00 1970

System time : 0.010319719 seconds fast of NTP time

Last offset : +0.0 seconds

RMS offset  : 0.0 seconds

Frequency   : 6.202 ppm slow

Residual freq   : +0.000 ppm

Skew: 0.000 ppm

Root delay  : 0.00 seconds

Root dispersion : 0.00 seconds

Update interval : 0.0 seconds

Leap status : Not synchronised


while a "well behaved" entry looks like:

/ # chronyc tracking

Reference ID: 212.45.144.16 (saguaro.bilink.it)

Stratum : 3

Ref time (UTC)  : Sun Aug  7 02:57:32 2016

System time : 0.08512 seconds fast of NTP time

Last offset : -0.000437271 seconds

RMS offset  : 0.000437271 seconds

Frequency   : 6.202 ppm slow

Residual freq   : -7.681 ppm

Skew: 0.040 ppm

Root delay  : 0.024563 seconds

Root dispersion : 0.047727 seconds

Update interval : 1.9 seconds

Leap status : Normal



Il 07/08/2016 01:07, Steve Horton ha scritto:


Chronyc tracking -will show how "off" you are from the time of your servers 
UTC. I usually set my clocks in the bios to utc, or very close and chrony will use this 
as a starting point after boot.


On Aug 6, 2016 12:11 PM, "Mauro Condarelli" > wrote:

Hi,
I need to start an application with stable and confirmed date, i.e.: 
after chrony has started, initialized and set the system clock to some presumably 
valid value.
Since I am using clock skewing if system time is in the future (need 
strictly monotonic time), internet connection may be missing at startup and 
several other mishaps, it may take a somewhat long time for chrony to stabilize 
(even several minutes).

How can I test (from shell script) if and when system time is (supposed to 
be) stable?

TiA
Mauro

-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org  with "unsubscribe" in the subject.

For help email chrony-users-requ...@chrony.tuxfamily.org 
 with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org 
.




--
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.

Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Getting chrony status

2016-08-07 Thread Steve Horton
It will only show synchronized after such time. It'll be the last line I
think. I pipe it out to a file and grep, loop, clear file, sleep 1 min,
repeat. Not pretty but it works.

On Aug 6, 2016 11:06 PM, "Mauro Condarelli"  wrote:

> Thanks Steve.
> I know about "chronyc tracking", but that is human-readable info.
> I need to parse it (in a shell script) to delay starting of my app until
> time has settled down.
> Is it enough to wait for "Leap status" to go to "Normal"?
> ... or should I take into consideration other values?.
>
> typical output at startup is:
>
> / # chronyc tracking
>
> Reference ID: 0.0.0.0 ()
>
> Stratum : 0
>
> Ref time (UTC)  : Thu Jan  1 00:00:00 1970
>
> System time : 0.010319719 seconds fast of NTP time
>
> Last offset : +0.0 seconds
>
> RMS offset  : 0.0 seconds
>
> Frequency   : 6.202 ppm slow
>
> Residual freq   : +0.000 ppm
>
> Skew: 0.000 ppm
>
> Root delay  : 0.00 seconds
>
> Root dispersion : 0.00 seconds
>
> Update interval : 0.0 seconds
>
> Leap status : Not synchronised
>
>
> while a "well behaved" entry looks like:
>
> / # chronyc tracking
>
> Reference ID: 212.45.144.16 (saguaro.bilink.it)
>
> Stratum : 3
>
> Ref time (UTC)  : Sun Aug  7 02:57:32 2016
>
> System time : 0.08512 seconds fast of NTP time
>
> Last offset : -0.000437271 seconds
>
> RMS offset  : 0.000437271 seconds
>
> Frequency   : 6.202 ppm slow
>
> Residual freq   : -7.681 ppm
>
> Skew: 0.040 ppm
>
> Root delay  : 0.024563 seconds
>
> Root dispersion : 0.047727 seconds
>
> Update interval : 1.9 seconds
>
> Leap status : Normal
>
>
>
> Il 07/08/2016 01:07, Steve Horton ha scritto:
>
>>
>> Chronyc tracking -will show how "off" you are from the time of your
>> servers UTC. I usually set my clocks in the bios to utc, or very close and
>> chrony will use this as a starting point after boot.
>>
>>
>> On Aug 6, 2016 12:11 PM, "Mauro Condarelli"  mc5...@mclink.it>> wrote:
>>
>> Hi,
>> I need to start an application with stable and confirmed date,
>> i.e.: after chrony has started, initialized and set the system clock to
>> some presumably valid value.
>> Since I am using clock skewing if system time is in the future (need
>> strictly monotonic time), internet connection may be missing at startup and
>> several other mishaps, it may take a somewhat long time for chrony to
>> stabilize (even several minutes).
>>
>> How can I test (from shell script) if and when system time is
>> (supposed to be) stable?
>>
>> TiA
>> Mauro
>>
>> -- To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org
>>  with "unsubscribe" in
>> the subject.
>> For help email chrony-users-requ...@chrony.tuxfamily.org > chrony-users-requ...@chrony.tuxfamily.org> with "help" in the subject.
>> Trouble?  Email listmas...@chrony.tuxfamily.org > listmas...@chrony.tuxfamily.org>.
>>
>>
>
> --
> To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org with
> "unsubscribe" in the subject.
> For help email chrony-users-requ...@chrony.tuxfamily.org with "help" in
> the subject.
> Trouble?  Email listmas...@chrony.tuxfamily.org.
>
>


Re: [chrony-users] Getting chrony status

2016-08-06 Thread Steve Horton
Chronyc tracking -will show how "off" you are from the time of your servers
UTC. I usually set my clocks in the bios to utc, or very close and chrony
will use this as a starting point after boot.

On Aug 6, 2016 12:11 PM, "Mauro Condarelli"  wrote:

> Hi,
> I need to start an application with stable and confirmed date, i.e.:
> after chrony has started, initialized and set the system clock to some
> presumably valid value.
> Since I am using clock skewing if system time is in the future (need
> strictly monotonic time), internet connection may be missing at startup and
> several other mishaps, it may take a somewhat long time for chrony to
> stabilize (even several minutes).
>
> How can I test (from shell script) if and when system time is (supposed to
> be) stable?
>
> TiA
> Mauro
>
> --
> To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org with
> "unsubscribe" in the subject.
> For help email chrony-users-requ...@chrony.tuxfamily.org with "help" in
> the subject.
> Trouble?  Email listmas...@chrony.tuxfamily.org.
>
>