From e5cb8d4dfeee214d8e2e585c6fb625863e0ecd6e Mon Sep 17 00:00:00 2001 From: J William Piggott Date: Sun, 13 Aug 2017 13:11:25 -0400 Subject: hwclock: refactor set_system_clock() Signed-off-by: J William Piggott --- sys-utils/hwclock.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'sys-utils/hwclock.c') 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; } /* -- cgit v1.2.3-55-g7522