]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: remove --compare option
authorSami Kerola <kerolasa@iki.fi>
Tue, 10 Jan 2017 21:16:20 +0000 (21:16 +0000)
committerSami Kerola <kerolasa@iki.fi>
Sat, 4 Feb 2017 23:39:38 +0000 (23:39 +0000)
Compare functionality was printing nonsense values.  There is no knowledge
of anyone using this broken functionality.  Instead of deprecating the code
for months, and removing it after few release, it is removed immediately.
Needless to say this is unusual removal.

Reference: http://marc.info/?l=util-linux-ng&m=148396210506652&w=2
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Documentation/deprecated.txt
bash-completion/hwclock
sys-utils/hwclock.8.in
sys-utils/hwclock.c
sys-utils/hwclock.h

index fba47e0b5859f1d3cf29ada0b767f085e2c224ea..df7f18fbf1cf943218ca94c101f57376386cc0b8 100644 (file)
@@ -8,6 +8,11 @@ since: v2.30
 
 --------------------------
 
+what:  hwclock --compare
+why:   Output printed by --compare option was nonesense.
+
+--------------------------
+
 what:  tailf
 why:   "tail -f" is better nowadays, tailf has unfixed bugs
 
index de1ac20f356491b176427d595058eb05f3e2576d..89b17bd0793656017c4e7653654a343729f5c704 100644 (file)
@@ -32,7 +32,6 @@ _hwclock_module()
                                --systohc
                                --systz
                                --adjust
-                               --compare
                                --getepoch
                                --setepoch
                                --predict
index 9534c19bcb96a54f2209db4e11a7edc62b2bbd35..2dec7823e3710c3d79e7d8c6e05d426c5bb3781a 100644 (file)
@@ -41,12 +41,6 @@ discussion below, under
 .BR "The Adjust Function" .
 .
 .TP
-.BR \-c , \ \-\-compare
-Periodically compare the Hardware Clock to the System Time and output
-the difference every 10 seconds.  This will also print the frequency
-offset and tick.
-.
-.TP
 .B \-\-getepoch
 .TQ
 .B \-\-setepoch
index 8716946d63a52653bc508679fa088c95cdbb586c..02a028950ec40a10c9d8fb13e9938c190743229e 100644 (file)
@@ -1364,63 +1364,6 @@ manipulate_epoch(const struct hwclock_control *ctl)
 # endif                /* __alpha__ */
 #endif         /* __linux__ */
 
-/*
- * Compare the system and CMOS time and output the drift
- * in 10 second intervals.
- */
-static int compare_clock(const struct hwclock_control *ctl)
-{
-       struct tm tm;
-       struct timeval tv;
-       double time1_sys, time2_sys;
-       time_t time1_hw, time2_hw;
-       bool hclock_valid = FALSE, first_pass = TRUE;
-
-       if (ur->get_permissions())
-               return EX_NOPERM;
-
-       /* dummy call for increased precision */
-       gettimeofday(&tv, NULL);
-
-       synchronize_to_clock_tick(ctl);
-       ur->read_hardware_clock(ctl, &tm);
-
-       gettimeofday(&tv, NULL);
-       time1_sys = tv.tv_sec + tv.tv_usec / 1000000.0;
-
-       mktime_tz(ctl, tm, &hclock_valid, &time1_hw);
-
-       while (1) {
-               double res;
-
-               synchronize_to_clock_tick(ctl);
-               ur->read_hardware_clock(ctl, &tm);
-
-               gettimeofday(&tv, NULL);
-               time2_sys = tv.tv_sec + tv.tv_usec / 1000000.0;
-
-               mktime_tz(ctl, tm, &hclock_valid, &time2_hw);
-
-               if ((res = time2_hw - time1_hw))
-                       res = (((double)time1_hw - time1_sys) -
-                              ((double)time2_hw - time2_sys))
-                           / res;
-
-               if (!first_pass)
-                       printf("%10.0f   %10.6f   %15.0f   %4.0f\n",
-                               (double) time2_hw, time2_sys, res * 1e6, res *1e4);
-               else {
-                       first_pass = FALSE;
-                       printf("hw-time      system-time         freq-offset-ppm   tick\n");
-                       printf("%10.0f   %10.6f\n", (double) time1_hw, time1_sys);
-               }
-               fflush(stdout);
-               sleep(10);
-       }
-
-       return 0;
-}
-
 static void out_version(void)
 {
        printf(UTIL_LINUX_VERSION);
@@ -1459,7 +1402,6 @@ static void usage(const struct hwclock_control *ctl, const char *fmt, ...)
                "     --systz          set the system time based on the current timezone\n"
                "     --adjust         adjust the RTC to account for systematic drift since\n"
                "                        the clock was last set or adjusted\n"), usageto);
-       fputs(_(" -c, --compare        periodically compare the system clock with the CMOS clock\n"), usageto);
 #ifdef __linux__
        fputs(_("     --getepoch       print out the kernel's hardware clock epoch value\n"
                "     --setepoch       set the kernel's hardware clock epoch value to the \n"
@@ -1547,7 +1489,6 @@ int main(int argc, char **argv)
 
        static const struct option longopts[] = {
                {"adjust",      0, 0, 'a'},
-               {"compare",     0, 0, 'c'},
                {"help",        0, 0, 'h'},
                {"show",        0, 0, 'r'},
                {"hctosys",     0, 0, 's'},
@@ -1627,7 +1568,7 @@ int main(int argc, char **argv)
        atexit(close_stdout);
 
        while ((c = getopt_long(argc, argv,
-                               "?hvVDacrsuwAJSFf:", longopts, NULL)) != -1) {
+                               "?hvVDarsuwAJSFf:", longopts, NULL)) != -1) {
 
                err_exclusive_options(c, longopts, excl, excl_st);
 
@@ -1638,9 +1579,6 @@ int main(int argc, char **argv)
                case 'a':
                        ctl.adjust = 1;
                        break;
-               case 'c':
-                       ctl.compare = 1;
-                       break;
                case 'r':
                        ctl.show = 1;
                        break;
@@ -1773,7 +1711,7 @@ int main(int argc, char **argv)
 
        if (!(ctl.show | ctl.set | ctl.systohc | ctl.hctosys |
             ctl.systz | ctl.adjust | ctl.getepoch | ctl.setepoch |
-            ctl.predict | ctl.compare | ctl.get))
+            ctl.predict | ctl.get))
                ctl.show = 1;   /* default to show */
 
 #ifdef __linux__
@@ -1796,14 +1734,7 @@ int main(int argc, char **argv)
                /* Avoid writing adjtime file if we don't have to. */
                adjtime.dirty = FALSE;
        ctl.universal = hw_clock_is_utc(&ctl, adjtime);
-       if (ctl.compare) {
-               if (compare_clock(&ctl))
-                       hwclock_exit(&ctl, EX_NOPERM);
-
-               rc = EX_OK;
-       } else
-               rc = manipulate_clock(&ctl, set_time, startup_time, &adjtime);
-
+       rc = manipulate_clock(&ctl, set_time, startup_time, &adjtime);
        hwclock_exit(&ctl, rc);
        return rc;              /* Not reached */
 }
index cd1d3b6cfaf7f9990004357a6ef5730af340c22a..b08bd2d7a87cc8fe45cf37e5ba7d8236e84f3aad 100644 (file)
@@ -28,7 +28,6 @@ struct hwclock_control {
                hwaudit_on:1,
 #endif
                adjust:1,
-               compare:1,
                show:1,
                hctosys:1,
                utc:1,