summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Kerola2017-01-10 22:16:20 +0100
committerSami Kerola2017-02-05 00:39:38 +0100
commit92931ab28d2f9174b884b4373d6cdd1e0ef350d4 (patch)
tree74eaea1f7c6418b0e275dbfd315d2362b9a2da40
parenthwclock: remove trailing dot from messages that include system error message (diff)
downloadkernel-qcow2-util-linux-92931ab28d2f9174b884b4373d6cdd1e0ef350d4.tar.gz
kernel-qcow2-util-linux-92931ab28d2f9174b884b4373d6cdd1e0ef350d4.tar.xz
kernel-qcow2-util-linux-92931ab28d2f9174b884b4373d6cdd1e0ef350d4.zip
hwclock: remove --compare option
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>
-rw-r--r--Documentation/deprecated.txt5
-rw-r--r--bash-completion/hwclock1
-rw-r--r--sys-utils/hwclock.8.in6
-rw-r--r--sys-utils/hwclock.c75
-rw-r--r--sys-utils/hwclock.h1
5 files changed, 8 insertions, 80 deletions
diff --git a/Documentation/deprecated.txt b/Documentation/deprecated.txt
index fba47e0b5..df7f18fbf 100644
--- a/Documentation/deprecated.txt
+++ b/Documentation/deprecated.txt
@@ -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
diff --git a/bash-completion/hwclock b/bash-completion/hwclock
index de1ac20f3..89b17bd07 100644
--- a/bash-completion/hwclock
+++ b/bash-completion/hwclock
@@ -32,7 +32,6 @@ _hwclock_module()
--systohc
--systz
--adjust
- --compare
--getepoch
--setepoch
--predict
diff --git a/sys-utils/hwclock.8.in b/sys-utils/hwclock.8.in
index 9534c19bc..2dec7823e 100644
--- a/sys-utils/hwclock.8.in
+++ b/sys-utils/hwclock.8.in
@@ -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
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 8716946d6..02a028950 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -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 */
}
diff --git a/sys-utils/hwclock.h b/sys-utils/hwclock.h
index cd1d3b6cf..b08bd2d7a 100644
--- a/sys-utils/hwclock.h
+++ b/sys-utils/hwclock.h
@@ -28,7 +28,6 @@ struct hwclock_control {
hwaudit_on:1,
#endif
adjust:1,
- compare:1,
show:1,
hctosys:1,
utc:1,