[Dovecot] Time just moved backwards error even with ntpd

Alexander Moisseev moiseev at mezonplus.ru
Mon Jan 21 09:57:43 EET 2008


On some FreeBSD 6.2 systems I was solved this problem just by adding to crontab:
@hourly        /sbin/sysctl `/sbin/sysctl -e machdep.adjkerntz` >/dev/null 2>&1

For some explanation, see:
http://lists.freebsd.org/pipermail/freebsd-hackers/2005-August/013383.html

Quote follows:

... It seems that CMOS clock is updated using resettodr(9) function. There
seem to be only a few occasions when this function is called:

1. clock_settime(ClOCK_REALTIME) // through kern_time.c:settime()
2. settimeofday() // through kern_time.c:settime()
3. machdep.adjkerntz sysctl is set

I believe that ntpd calls *settime-family* functions *only* if time offset
is *larger* than *128ms* (or maybe I am thinking about ntpdate), but
normally it uses ntp_adjtime() to adjust time keeping. Obviosuly, a
system running ntpd with good enough hardware clock and good enough
connection to good enough ntp server(s) would use the latter method all
of the time after some initial stabilization period. But it seems that
time changes are *never propagated to CMOS* in this case, ...

Alexander


More information about the dovecot mailing list