Operating System - HP-UX
1833325 Members
2798 Online
110051 Solutions
New Discussion

Re: monitoring "date -a -60"

 
Marc Ahrendt
Super Advisor

monitoring "date -a -60"

i understand what this command does: it will slow the system clock down by 1 minute ...but gradually

i do not understand how to monitor it ...basically when it has completed slewing the clock, and/or even know what its rate of change on the system clock is

running "ps -ef | grep date" gives me nothing
hola
7 REPLIES 7
Marc Ahrendt
Super Advisor

Re: monitoring "date -a -60"

forgot to mention the reason i want to monitor this process is that when "date -a -60" is done i actually want to run it again ...and so concern about the impact of using this command multiple times

also, when i am done (which i am hoping to find a way to know as so to automate/script it), i will be starting NTP, and so i do not want the "date -a -60" to be conflicting with NTP when NTP is turned on when i feel the clock is relatively close (within several seconds) to the NTP server
hola
Charles McCary
Valued Contributor

Re: monitoring "date -a -60"

what about running something like this on another system:

while true
do
date
sleep 1
done

and periodically comparing that output with the date on the system in question. Of course, you'd have to know the difference in the time between the two systems before you start. Tedious, but it should work.
A. Clay Stephenson
Acclaimed Contributor

Re: monitoring "date -a -60"

The key to understanding the behavior of this command --- and multiple invocations of the same comand is to study the underlying system call: adjtime(). Man 2 adjtime and all should be clear.
If it ain't broke, I can fix that.
Marc Ahrendt
Super Advisor

Re: monitoring "date -a -60"

charles, thx for the suggestion but that is what i want to avoid ...sorry about not stating that

clay, you hit the key point i needed addressed. the man page explains that when i run "date -a -60" again it doesn't undo any previous slewing (good!), and that there is even a way with some scripting to use adjtime to see how much work it has left ...sad thing for me is that i have lost all my C prorgramming skills, so even with the example they give (using the command to know when the adjustment is completed) it is difficult for me to implement it
hola
Mark Ellzey
Valued Contributor

Re: monitoring "date -a -60"

Marc,

Why not just connect to the NTP server? It will adjust the local clock slowly anyhow. I've done it with machines up to 5 minutes time difference with no ill effects.

Regards,
Mark
Bill Hassell
Honored Contributor

Re: monitoring "date -a -60"

You won't see any change at all on the HP-UX server. Time slewing is done at in very small changes such that no time tick is lost. The only way you'll see the difference is to have another system to compare the time. This is how NTP keeps your system accurate to within 128ms and every day will always have exactly 86400 seconds even if the time had to be corrected by a couple of minutes.


Bill Hassell, sysadmin
Marc Ahrendt
Super Advisor

Re: monitoring "date -a -60"

thx mark, but i familiar with NTP and do not want to use it ...in fact i am turning off NTP on the system as so to run the date command!

thx bill, i think there is away to know about the progress of the date command as indicated by Clay ...via adjtime(). you may be right in the sense that i must use another system to compare against to see how much time is being lost (basically the rate of the slowing), but on the local system it apppears that there is a way to know when its done doing its job ...just that i need to dust off my brain where the C coding skills may still be as so to play with adjtime()!
hola