Package: adjtimex
Version: 1.21.1-3
Severity: normal
Tags: patch

Hello,

Reportedly, on some machines, adjtimex hangs with the /dev/rtc driver,
because ioctl(RTC_UIE_ON) succeeds, but no interrupt never comes. The
attached patch adds a --directisa option to adjtimex, named after the
hwclock --directisa option, and doing the same thing: Bypass the
/dev/rtc driver.

BTW --version shows 1.20 instead of 1.21.1


Alain.
diff -prud adjtimex-1.21.1.orig/adjtimex.c adjtimex-1.21.1/adjtimex.c
--- adjtimex-1.21.1.orig/adjtimex.c     Sun Sep 23 11:10:17 2007
+++ adjtimex-1.21.1/adjtimex.c  Sun Sep 23 18:52:31 2007
@@ -119,6 +120,7 @@ struct option longopt[]=
   {"timeconstant", 1, NULL, 'T'},
   {"tick", 1, NULL, 't'},
   {"utc", 0, NULL, 'u'},
+  {"directisa", 0, NULL, 'd'},
   {"version", 0, NULL, 'v'},
   {"verbose", 0, NULL, 'V'},
   {"watch", 0, NULL, 'w'},
@@ -199,10 +201,11 @@ usage(void)
 "       -c, --compare[=count]     compare system and CMOS clocks\n"
 "       -i, --interval tim        set clock comparison interval (sec)\n"
 "       -l, --log[=file]          log current times to file\n"
-"           --host timeserver     query the timeserver\n"
+"       -h, --host timeserver     query the timeserver\n"
 "       -w, --watch               get current time from user\n"
 "       -r, --review[=file]       review clock log file, estimate drifts\n"
 "       -u, --utc                 the CMOS clock is set to UTC\n"
+"       -d, --directisa           access the CMOS clock directly\n"
 "\n"
 "Informative Output:\n"
 "           --help                print this help, then exit\n"
@@ -276,7 +279,7 @@ main(int argc, char *argv[])
     txc.modes = 0;
 
     while((c = getopt_long_only(argc, argv, 
-                               "a::c::l::e:f:h:i:m:o:prPPsPS:RT:t:uvVw", 
+                               "a::c::l::e:f:h:i:m:o:prPPsPS:RT:t:udvVw", 
                                longopt, NULL)) != -1)
       {
        switch(c)
@@ -367,6 +370,9 @@ main(int argc, char *argv[])
          case 'u':
            universal = 1;
            break;
+         case 'd':
+           using_dev_rtc = 0;
+           break;
          case 'v':
            {
              printf("adjtimex %s\n", VERSION);
diff -prud adjtimex-1.21.1.orig/adjtimex.8 adjtimex-1.21.1/adjtimex.8
--- adjtimex-1.21.1.orig/adjtimex.8     Fri May 26 23:06:38 2006
+++ adjtimex-1.21.1/adjtimex.8  Sun Sep 23 22:30:17 2007
@@ -115,6 +115,8 @@ follow.
 \-\-review[=\fIfile\fP]
 \-u
 \-\-utc
+\-d
+\-\-directisa
 .TP
 \fBInformative Output\fP
 \-\-help
@@ -263,6 +265,21 @@ Set the interval in seconds between cloc
 \fB\-\-compare\fP and \fB\-\-adjust\fP options.
 .IP "\fB\-u\fP, \fB\-\-utc\fP"
 The CMOS clock is set to UTC (universal time) rather than local time.
+.IP "\fB\-d\fP, \fB\-\-directisa\fP"
+To read the CMOS clock accurately, \fBadjtimex\fP usually accesses the
+clock via the /dev/rtc device driver of the kernel, and makes use of its
+CMOS update-ended interrupt to detect the beginning of seconds. When the
+/dev/rtc driver is absent, or when the interrupt is not available,
+\fBadjtimex\fP can sometimes automatically fallback to a direct access
+method. This method detects the start of seconds by polling the
+update\-in\-progress (UIP) flag of the CMOS clock. You can force this
+direct access to the CMOS chip with the \fB\-\-directisa\fP switch.
+
+Note that the /dev/rtc interrupt method is more accurate, less sensible
+to perturbations due to system load, cleaner, cheaper, and is generally
+better than the direct access method. It is advisable to not use the
+\fB\-\-directisa\fP switch, unless the CMOS chip or the motherboard
+don't properly provide the necessary interrupt.
 .IP "\fB\-l\fP[\fIfile\fP], \fB\-\-log\fP[\fB=\fP\fIfile\fP]"
 Save the current values of the system and CMOS clocks, and optionally
 a reference time, to \fIfile\fP (default \fI/var/log/clocks.log\fP).

Reply via email to