Andriy Gapon <a...@icyb.net.ua> writes:
> Dag-Erling Smørgrav <d...@des.no> writes:
> > Andriy Gapon <a...@icyb.net.ua> writes:
> > > Also, I am aware that the period should be configurable (sysctl).
> > Why?
> Because there would always be someone who would want a different value :)
> > Although I can see an argument for a sysctl to turn it on or off.
> Good idea.

You can combine the two - P == 0 means "don't save", P > 0 means "save
every P minutes".

> > IIRC, Linux saves the clock at shutdown, and every 11 minutes if and
> > only if the system clock is synchronized to an external reference.
> Both are good ideas too.
> I know how to add a shutdown hook (event handler), but I don't know how to 
> check
> if time synchronization is taking place.

adjtime() / adjtimex() sets a flag.  I'm not sure if (or how) the flag
is cleared when synchronization stops (i.e. /etc/rc.d/ntpd stop);
perhaps the simplest solution is to set a T = monotime() every time
adjtime() is called, and check that monotime() - (T * 60) < (P * 60).

DES
-- 
Dag-Erling Smørgrav - d...@des.no
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to