summaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorJ William Piggott2017-08-13 19:11:25 +0200
committerJ William Piggott2017-08-25 00:48:47 +0200
commite5cb8d4dfeee214d8e2e585c6fb625863e0ecd6e (patch)
tree9139c7c2c7f5059bfcd5589214b51d5870908b50 /sys-utils
parenthwclock: update set_system_clock comments (diff)
downloadkernel-qcow2-util-linux-e5cb8d4dfeee214d8e2e585c6fb625863e0ecd6e.tar.gz
kernel-qcow2-util-linux-e5cb8d4dfeee214d8e2e585c6fb625863e0ecd6e.tar.xz
kernel-qcow2-util-linux-e5cb8d4dfeee214d8e2e585c6fb625863e0ecd6e.zip
hwclock: refactor set_system_clock()
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/hwclock.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index c398d608e..af0f906dc 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -604,9 +604,6 @@ static int
set_system_clock(const struct hwclock_control *ctl,
const struct timeval newtime)
{
- int retcode;
-
- const struct timeval *tv_null = NULL;
struct tm *broken;
int minuteswest;
int rc = 0;
@@ -643,14 +640,13 @@ set_system_clock(const struct hwclock_control *ctl,
if (ctl->testing) {
printf(_
("Test mode: clock was not changed\n"));
- retcode = 0;
} else {
- const struct timezone tz = { minuteswest, 0 };
+ const struct timezone tz = { minuteswest };
if (ctl->hctosys && !ctl->universal) /* set PCIL */
- rc = settimeofday(tv_null, &tz);
+ rc = settimeofday(NULL, &tz);
if (ctl->systz && ctl->universal) /* lock warp_clock */
- rc = settimeofday(tv_null, &tz_utc);
+ rc = settimeofday(NULL, &tz_utc);
if (!rc && ctl->hctosys)
rc = settimeofday(&newtime, &tz);
else if (!rc)
@@ -658,11 +654,10 @@ set_system_clock(const struct hwclock_control *ctl,
if (rc) {
warn(_("settimeofday() failed"));
- retcode = 1;
- } else
- retcode = 0;
+ return 1;
+ }
}
- return retcode;
+ return 0;
}
/*