2010-04-16 James R. Van Zandt <jrvz@comcast.net> * Makefile.in (VERSION): version 1.29 * adjtimex.man: Document the --force-adjust option. 2010-04-15 James R. Van Zandt <jrvz@comcast.net> * adjtimex.c (compare): --force-adjust suppresses warning printouts. (compare): relax sanity check to +- 1 percent. 2009-11-07 James R. Van Zandt <jrvz@comcast.net> * Makefile.in (VERSION): version 1.28 * adjtimex.c (compare): Correctly apply +-500 ppm sanity check (Thanks to Jacques luder <j.luder@laposte.net>) 2009-04-18 James R. Van Zandt <jrvz@comcast.net> * Makefile.in (VERSION): version 1.27.1 Add rules for running autoconf, autoheader, and ./configure. (adjtimex): Depend on Makefile, so it's recompiled if the version number changes. (SRC): include config.h.in * adjtimex.c (struct rtc_time): Provide workaround if linux/rtc.h is missing. * configure.in: Check for linux/rtc.h, but not limits.h (no longer used), sys/time.h, or unistd.h (there is no workaround implemented). 2009-03-22 James R. Van Zandt <jrvz@comcast.net> * Makefile.in (VERSION): version 1.27 * adjtimex.c (review): HELP is an enum instead of a #define. * adjtimex.c: Add some training calls to gettimeofday, so following calls will be more accurate (thanks to Alain Guibert <alguibert+bts@free.fr>). 2009-03-14 James R. Van Zandt <jrvz@comcast.net> * adjtimex.c (review): Compute CMOS frequency error in PPM of CMOS time (thanks to Alain Guibert <alguibert+bts@free.fr>). (review): Compute sys_time or the relative error between CMOS and sys_time in PPM of sys_time. 2009-03-14 Alain Guibert <alguibert@free.fr> * adjtimex.c (compare, log_times): The first call to gettimeofday() in a process takes longer than usual, and the timestamp taken is a little bit late (up to 200 microseconds). Let's consume this bad call, so that the important timestamps are all coherant at the top of accuracy. * (log_times): We don't need the kernel's internal timezone. Let's stop requesting it. 2009-03-11 James R. Van Zandt <jrvz@comcast.net> * adjtimex.8: Document --force-adjust option. * adjtimex.c (longopt): --force-adjust overrides +-500 ppm sanity check. verbose is now a counter, -V increases verbosity. Require more than one option for several printouts. Print invalid option characters. If stating local time, explicitly say with or without summertime adjustment. 2009-03-10 James R. Van Zandt <jrvz@comcast.net> * adjtimex.c (cmos_read_time): use select() instead of a timer to avoid blocking even if /dev/rtc never becomes readable. (That code was misplaced at some point in the last year.) If using update interrupt, sanity check the delay. Sometimes the status includes an update complete flag, but it actually didn't wait. Fall back to another method of reading RTC. 2008-08-17 James R. Van Zandt <jrv@vanzandt.comcast.net> * Makefile.in (VERSION): Write ISO8601 format data to .lsm file. Include commands to build Makefile (i.e. ./configure). version 1.26 * adjtimex.c (cmos_read_time): Fix a possible hang with the Intersil ISL1208, one of those new non-PC-compatible RTCs. Cleanly exits with an error message, instead of either hang or returning garbage. (Thanks to Alain Guibert). * adjtimex.lsm.in: Revise description, update file size. 2008-08-07 James R. Van Zandt <jrv@vanzandt.comcast.net> * Makefile.in (VERSION): version 1.25 * adjtimex.8: document new --nointerrupt option 2008-08-07 James R. Van Zandt <jrvz@comcast.net> * adjtimex.8: Kernels through 2.6 are still using the same adjtimex status values. Mention new /dev file names. * adjtimex.c (cmos_init): try alternate ia64 and devfs device names (courtesy of hwclock sources). * adjtimex.c (cmos_read_time): Set an alarm to avoid blocking even if /dev/rtc never becomes readable, then fall back to busywait_second_change(). New --nointerrupt option to force busywait without waiting for the interrupt timeout (thanks to Alain Guibert). 2008-04-04 James R. Van Zandt <jrv@vanzandt.comcast.net> * Makefile (VERSION): version 1.24 * adjtimex.c: Reorganize cmos_read_time() to properly integrate the fallback case for when /dev/rtc has no interrupts. Make this fallback actually work. fixes partially(?) Debian bug #460065 as by proposed solution #1 (Thanks to Alain Guibert <alguibert@free.fr>) (closes:Bug#471203) (cmos_read_time): Fix Y2K bug: read century from byte 50, instead of assuming we're in the range 1969-2068. (busywait_second_change) When /dev/rtc interrupt is not available, fallbacks to loops around ioctl(RTC_RD_TIME) until the RTC second changes. Patch applies to adjtimex 1.23 above first no-interrupt-fallback.patch fixes partially(?) Debian bug #460065 as by proposed solution #3 (Thanks to: Alain Guibert <alguibert@free.fr>) (cmos_read_time) If /dev/rtc does not exist then automatically fallback to /dev/rtc0, so it works even without symlink. (Thanks to: Alain Guibert <alguibert@free.fr>) 2008-04-03 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c (main): fix typo in options handling (thanks to Miroslav Lichvar <mlichvar@redhat.com>) 2008-02-07 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c (log_times): Convert some fprintf writes to perror, add "adjtimex: " to several perror messages. 2008-02-01 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c: (cmos_read_time): use select() to avoid blocking even if /dev/rtc never becomes readable. 2007-10-06 James R. Van Zandt <jrv@vanzandt.comcast.net> * Makefile.in (VERSION): version 1.23 * adjtimex.c (cmos_read_time): rename dummy to interrupt_info now that this read() value is actually used. (thanks to Alain Guibert <alguibert@free.fr>) * README: Rewrite USAGE paragraph. Remove point about creating zero adjfile. Document new behaviour without adjfile. Remove reference to the long outdated clock(8). Update URL for hwclock(8). (Thanks to Alain Guibert <alguibert@free.fr>) * adjtimex.c (cmos_read_time): The day-of-week value in the RTC free cycles from 1 to 7. This number is not synced with other RTC date values, but is only simply incremented at midnight. The day meant is in the eye of the reader, which nearly always just ignores the value. Most common assumption is that 1 means Sunday. (Thanks to Alain Guibert <alguibert@free.fr>) * adjtimex.c (compare): In case of absence of /etc/adjtime, do not fail, and do not force users to manually create it with 0.0 content. Instead, proceed assuming zero values (meaning RTC does not drift). Also replace redundant code by a call to get_cmos_adjustment(). (Thanks to Alain Guibert <alguibert@free.fr> 2007-10-05 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c (busy_wait): timestamp more closely the RTC clock beat (thanks to Alain Guibert <alguibert at free.fr>, see Debian bug#443814). (usage): --directisa switch forces adjtimex to poll the update-in-process (UIP) flag of the CMOS clock (thanks to Alain Guibert <alguibert at free.fr>, see Debian bug#443773). 2007-09-23 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c (log_times): fix these bugs in ntpdate output interpretation (per Debian bug#438718): adjtimex has a bug in evaluating the output of ntpdate, because 1. it assumes ntpdate outputs "adjust time server", but ntpdate may output "step time server" also 2. it doesnt stop at last line but as soon as it has found "filter offset:" lines, and because of this it will not find the "offset ..." information in the last line. 2006-10-07 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c: don't declare adjtimex syscall (should already be getting the declaration from sys/timex.h) 2006-05-27 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c (log_times): Permit ntpdate to contact any number of time servers. (log_times): add -q to ntpdate command line (puthackent): with --verbose, display log entry and path to log file. (valid_system_rate, valid_cmos_rate): in messages, ask about /sbin/hwclock rather than the old /sbin/clock. (probe_time): If call to adjtimex fails, quit with error message. (Need root priv.) Thus, "adjtimex -r" and "adjtimex -c" fail rather than succeeding with bogus results. 2006-05-26 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c (log_times): use stat to look for ntpdate in /usr/bin, /bin, /usr/sbin and /sbin. Close pipe with pclose instead of fclose. * adjtimex.8: express PLL time constant in terms of a power of two rather than the more obscure 1<<val. 2006-05-25 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c (log_times): Eliminate compare_cmos_sys(), call cmos_read_time() instead. 2006-05-24 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c (review): For both CMOS and system clocks, write suggested and current adjustments on a separate line from the estimated error in ppm. (cmos_read_time): Move the sanity check code (to adjust CMOS time by multiples of one hour) and code to read sytem time into this function. 2006-05-23 James R. Van Zandt <jrv@vanzandt.comcast.net> * adjtimex.c (compare_cmos_sys): delete code to find UTC time via switching TZ (was controlled by ZONESWITCH, which was not #defined). * adjtimex.8: -h specifies the host, so it can't also ask for the help printout. -V or --verbose increases verbosity. Shifting CMOS time by up to 13 hours. 2006-05-23 James R. Van Zandt <jrv at debian.org> * adjtimex.c (cmos_read_time): set tm_isdst to -1 to signal that summer time information is not available (/dev/rtc doesn't set it) 2006-05-22 James R. Van Zandt <jrv at debian.org> * adjtimex.c (cmos_read_time): adjust month, day of week, and year only if reading from /dev/port. * Makefile (VERSION): version 1.21 * adjtimex.c (compare): Adjust CMOS times by + or - 60 min, if that brings them closer to the system time. If they still differ by more than 6 min, then print a warning and suppress logging. (Thanks to Alain Guibert <alguibert at free.fr> for noting that summer time start/end can impact the log.) 2006-05-21 James R. Van Zandt <jrv at debian.org> * ChangeLog: Fix spelling of name Alain Guibert (sorry :-) * adjtimex.c (cmos_read_time): use /dev/rtc interface if possible (thanks to Richard Henderson <rth at twiddle.net>). 2005-09-05 James R. Van Zandt <jrv at debian.org> * README: fix email address 2004-09-19 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.20 * adjtimex.c (compare): in "compare" or "adjust", return immediately after printing last result (instead of sleeping an extra $interval seconds) (Thanks to Alain Guibert <alguibert at free.fr>) 2004-09-11 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.19 * adjtimex.c (compare): Account for the current frequency value when calculating the recommended frequency value. Simplify calculation of recommended tick. (compare): print estimated system clock error in ppm instead of obscure "second diff". * adjtimex.8: use 2^16 instead of the more obscure 1<<16. * adjtimex.c: revert to poll-wait instead of using /dev/rtc, because the latter only provides time with one second precision. 2004-04-11 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.18 * Makefile.in (install): create manual directory if necessary * adjtimex.c (usage): Don't split strings across lines. (main): --reset switch enables resetting of status (no longer default action, because it's not needed by recent kernels) (thanks to Alain Guibert <alguibert at free.fr>) 2004-04-09 James R. Van Zandt <jrv at debian.org> * adjtimex.c (longopt): --status switch sets clock status (courtesy of Alain Guibert <alguibert at free.fr> 2004-04-04 James R. Van Zandt <jrv at debian.org> * Makefile.in (CFLAGS): add compiler switch -Wall (mandir): put man pages in $(prefix)/share/man/man8 2004-04-03 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.17 * adjtimex.c: update email (main): If adjtimex() returns an error, print HZ and legal ranges for tick and freq. (thanks to Sami Farin <safari at iki.fi>) (review): calculate reasonable tick and frequency when HZ != 100. (cmos_init): use /dev/rtc when available (thanks to Richard Henderson <rth at twiddle.net> * adjtimex.c (longopt): fix spelling to match documentation: --esterror and --maxerror (thanks to Alain Guibert) 2003-08-24 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.16 * adjtimex.c (main): added optstring, so options can be single letters again. 2003-05-31 James R. Van Zandt <jrv at debian.org> * adjtimex.c (usage): Escape the embedded newlines in the help message, and add explicit ones. (gcc 3.3 complains otherwise) 2003-04-30 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.15 * adjtimex.c: for ia64, call adjtimex instead of using syscall 2003-04-27 James R. Van Zandt <jrv at debian.org> * adjtimex.8: Compare the roles of ntpd, hwclock, and adjtimex. Fix case: -T (not -t) to set PLL time constant (thanks to Sanjoy Mahajan <sanjoy at mrao.cam.ac.uk> 2002-01-06 James R. Van Zandt <jrv at debian.org> * adjtimex.c (cmos_init): don't re-open the FD if it's already open (thanks to Jonathan H N Chin <jhnc%stone at newton.cam.ac.uk>) 2001-06-15 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.12.1 * README.ru: added Russian translation, courtesy of Alex Savvin <alex at dag.bryansk.ru> 2000-12-02 James R. Van Zandt <jrv at debian.org> * adjtimex.c (valid_cmos_rate): Fix grammar in message. 2000-11-21 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.12 * adjtimex.c (puthackent): clear lfile after closing file, so it does not get closed a second time (thanks to Bjorn Eriksson <mdeans at algonet.se>). 2000-05-14 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.11 * adjtimex.c (review): With both --review and --adjust, set sytem time parameters to the least-squares estimates. 2000-01-31 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.10 * adjtimex.c: #define _GNU_SOURCE so strptime is available * (log_times): use popen() to recover output from ntpdate, instead of an unsafe temporary file (thanks to Colin Phipps <crp22 at cam.ac.uk>) 2000-01-03 James R. Van Zandt <jrv at debian.org> * Makefile.in (VERSION): version 1.9 * adjtimex.c (usage): remove invalid entries -? and -h * adjtimex.c (main): Get version from -D flag rather than RCS string. * Makefile.in (adjtimex): Pass version in -D flag. * adjtimex.c (compare): Y2K fixes (okay until 2070) 1999-12-16 James R. Van Zandt <jrv at debian.org> * Makefile.in (adjtimex.lsm): make adjtimex.lsm from adjtimex.lsm.in (so version number gets entered automatically). * adjtimex.c (valid_system_rate): refer to ntpd instead of xntpd * adjtimex.8: refer to ntpd instead of xntpd * README: refer to ntpd instead of xntpd 1999-09-06 James R. Van Zandt <jrv at debian.org> * Makefile.in (bindir): executable goes into /sbin, so it's available even if /usr is in a separate filesystem. Removed unused variables DISTFILES and MISC. * (VERSION): 1.8 (setting here rather than using RCS version number of adjtimex.c) 1998-11-28 James R. Van Zandt <jrv at debian.org> * adjtimex.c: Don't use syscall1() to declare adjtimex() for Alpha. Courtesy of Paul Slootman <paul at debian.org> 1998-10-24 James R. Van Zandt <jrv at debian.org> * adjtimex.8: change references: clock -> hwclock 1998-08-22 root <jrv at debian.org> * adjtimex.c (gethackent): Create log file if it does not exist. 1998-08-18 James R. Van Zandt <jrv at debian.org> * adjtimex.8: default log file is "/var/log/clocks.log". 1998-04-20 James R. Van Zandt <jrv at debian.org> * adjtimex.c: Code cleanups to silence warnings: Added some casts. Removed unused variables. Added parens around assignments inside tests. Code is now covered by GNU GPL. 1997-12-11 James R. Van Zandt <jrv at debian.org> * adjtimex.c: Scanning wtmp rather than utmp, looking for clock resets and reboots. Storing log file entry in a struct hack_s. --compare-all or -C logs values of both clocks and a reference time: compare3(). --watch asks user for reference time. -h consults specified host for reference time (partial implementation). valid_system_rate() determines whether we can estimate system clock rate from previous inverval. valid_cmos_rate() determines whether we can estimate cmos clock rate from previous interval. cmos_adj() fetches cmos adjustment from config file. compare_cmos_sys() compares the times on the two clocks, using enhanced real time clock support (/proc/rtc) if not root. LOG_PATH, WTMP_PATH, and ADJPATH introduced. added mkgmtime() which is like mktime() but assumes it's given UTC. Removed old code which changes the TZ environment variable. --host uses ntpdate to call timeserver. Implemented puthackent(). Filling out struct hack, calling puthackent() to write it. valid_system_time() checks /etc/adjtime too. valid_*() used getch() to read single character -- won't work with buffered reads. Switched to fgets(). Using /proc/rtc if available and not root. review() calculates adjustments from log entries. uses kalman_update(), which uses matrix routines from mat.c. --compare-all renamed to --log. --log can be used with --compare. compare3() renamed to log_times(). hack.tref (log time) renamed to hack.log. Log time is taken from system time, or even cmos time, if reference time is not available. No longer printing sys_error header an extra time. An uncertainty is printed with two significant digits if the first digit is `1', and one significant digit otherwise. Optional arguments on --log and --review switches sets the log path Making no adjustment recommendations unless uncertainty is < 100 ppm. Caveating uncertainty of least-squares solution. Including string.h rather than strings.h Really implementing --version switch Displaying more informative help message Credit Michael Meskes. Error sends short message to stderr. Usage message reworded. 1997-11-26 James R. Van Zandt <jrv at debian.org> * adjtimex.c: Credit Michael Meskes. Error sends short message to stderr. Usage message reworded. 1997-11-25 James R. Van Zandt <jrv at debian.org> * adjtimex.c: Including string.h rather than strings.h Really implementing --version switch Displaying more informative help message * adjtimex.c: An uncertainty is printed with two significant digits if the first digit is `1', and one significant digit otherwise. Optional arguments on --log and --review switches sets the log path Making no adjustment recommendations unless uncertainty is < 100 ppm. Caveating uncertainty of least-squares solution. 1997-09-13 James R. Van Zandt <jrv at debian.org> * adjtimex.c: --compare-all renamed to --log. --log can be used with --compare. compare3() renamed to log_times(). hack.tref (log time) renamed to hack.log. Log time is taken from system time, or even cmos time, if reference time is not available. No longer printing sys_error header an extra time. 1997-09-01 James R. Van Zandt <jrv at debian.org> * adjtimex.c: LOG_PATH, WTMP_PATH, and ADJPATH introduced. added mkgmtime() which is like mktime() but assumes it's given UTC. Removed old code which changes the TZ environment variable. --host uses ntpdate to call timeserver. Implemented puthackent(). Filling out struct hack, calling puthackent() to write it. valid_system_time() checks /etc/adjtime too. valid_*() used getch() to read single character -- won't work with buffered reads. Switched to fgets(). Using /proc/rtc if available and not root. review() calculates adjustments from log entries. uses kalman_update(), which uses matrix routines from mat.c. 1997-08-21 James R. Van Zandt <jrv at debian.org> * adjtimex.c: Scanning wtmp rather than utmp, looking for clock resets and reboots. Storing log file entry in a struct hack_s. --compare-all or -C logs values of both clocks and a reference time: compare3(). --watch asks user for reference time. -h consults specified host for reference time (partial implementation). valid_system_rate() determines whether we can estimate system clock rate from previous inverval. valid_cmos_rate() determines whether we can estimate cmos clock rate from previous interval. cmos_adj() fetches cmos adjustment from config file. compare_cmos_sys() compares the times on the two clocks, using enhanced real time clock support (/proc/rtc) if not root. 1997-02-28 James R. Van Zandt <jrv at debian.org> Added --help and --version switches. 1997-02-25 James R. Van Zandt <jrv at debian.org> put settimeofday() stuff in separate function, called twice. Incorporated clockdiff functions into adjtimex, as the "--comparing" and "--adjusting" options. (Thanks to Michael Meskes <meskes at debian.org> for the idea -- he implemented this functionality in the configuration script of his Debian package.) Repeat count set by "--count", and interval set by "--interval". Parsing command line options with getopt_long_only(). Test for "-singleshot" had broken "-offset" option. 1997-02-21 James R. Van Zandt <jrv at debian.org> Removed "status" setting option. Checking that ADJ_OFFSET_SINGLESHOT is not used with any other option. Label "time" -> "raw time". Ensuring kernel resets its internal status to TIME_BAD by calling settimeofday(). 1995-03-15 James R. Van Zandt <jrv at debian.org> Moved documentation to README file and man page. Ran through indent. Usage msg only shows "print" once. 1995-03-07 James R. Van Zandt <jrv at debian.org> Initial revision