hwclock: increase debug output precision
PATCH 1/2 hwclock: increase debug output precision
Increased the precision in debug output showing
the clock drift and the time lapsed.
Showing a clock drift of 0.0 while giving a value that the drift factor was adjusted by makes no sense.
Signed-off-by J William Piggott <[email protected]>
--- sys-utils/hwclock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sys-utils/hwclock.c +2 -2
@@ -1062,8 +1062,8 @@ adjust_drift_factor(struct adjtime *adjtime_p, drift_factor =0 ; }else {if (debug) - printf(_("Clock drifted %.1f seconds in the past " - "%.1f seconds\nin spite of a drift factor of " + printf(_("Clock drifted %f seconds in the past " + "%f seconds\nin spite of a drift factor of " "%f seconds/day.\n" "Adjusting drift factor by %f seconds/day\n"), time_diff(nowtime, hclocktime),
PATCH 2/2 hwclock: non-root access in test mode
Allow a non-root user to call all hwclock
functions when the --test option is used.
Signed-off-by J William Piggott <[email protected]>
--- sys-utils/hwclock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sys-utils/hwclock.c +3 -3
@@ -1914,15 +1914,15 @@ int main(int argc, char **argv) permitted = TRUE; else {/* program is designed to run setuid (in some situations) */ -if (set || systohc || adjust) { +if ((set || systohc || adjust) && !testing) {warnx (_ ("Sorry, only the superuser can change " "the Hardware Clock." )); permitted = FALSE; - }else if (systz || hctosys) { + }else if ((systz || hctosys) && !testing) {warnx (_ ("Sorry, only the superuser can change " "the System Clock." )); permitted = FALSE; - }else if (setepoch) { + }else if (setepoch && !testing) {warnx (_ ("Sorry, only the superuser can change the " "Hardware Clock epoch in the kernel." )); permitted = FALSE;
Quoted 2 lines · J William Piggott
sys-utils/hwclock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied both patches (week ago:-), thanks
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com