Is there a maximum adjustment adjtime will accept?
What happens when I call adjtime, and the previous adjustment is not complete,
Is the new adjustment discarded, or is the old one lost?
Are there any side-effects to calling adjtime?
Is adjtime better than calling settimeofday?
How do I know when adjtime is complete, and how can I check to see if it did the
adjustment? I'm trying to use gettimeofday, but I don't see the adjustment.
Thanks for any help,
Glen Andrews
gand...@seas.gwu.edu
Some systems won't accept adjustments larger than MAXLONG/1000000 seconds
(about half an hour). That is due to a stupid implementation.
>What happens when I call adjtime, and the previous adjustment is not complete,
>Is the new adjustment discarded, or is the old one lost?
The new adjustment takes effect and the old one is "lost".
(The remaining old adjustment is returned as olddelta.)
To avoid that you can call adjtime() with a NULL delta and
add the olddelta to the new adjustment
and then call adjtime() with the adjusted new adjustment.
>Are there any side-effects to calling adjtime?
Well, the clock might start running faster or slower,
if the call fails it will set errno,
the call will consume CPU time,
in some implementations the call is logged if system call
tracing is in effect. Stuff like that.
>Is adjtime better than calling settimeofday?
Much better, because the clock does not abruptly jump forwards
or (much worse) backwards. This is best for small adjustments.
Use settimeofday() if the current clock is off by a year!
Call adjtime() with a NULL delta and consult the olddelta.
Please also re-read the man page.
Good luck.
Tom Truscott
Uhoh! Wouldn't want _that_.
- Logan
Who wants an version of sleep() that accepts negative numbers:
$ at now + 1 day
at> cd /var/spool/news
at> tar cf - ./misc/headlines | (sleep -86400 ; cat > /tmp/foo.tar)
at> ^D
$
--
Logan Shaw, Unix Systems Administrator
"everybody / loves to see / justice done / on somebody else" (Bruce Cockburn)