diff options
author | J William Piggott | 2017-08-06 18:17:10 +0200 |
---|---|---|
committer | J William Piggott | 2017-08-25 00:30:39 +0200 |
commit | 3a7669aa8ab5c07044aea66c8e2d9e4a1f5ab1cc (patch) | |
tree | d5548a8f582167d3a83249630cef157176834a00 /sys-utils | |
parent | hwclock: move systz into hctosys (diff) | |
download | kernel-qcow2-util-linux-3a7669aa8ab5c07044aea66c8e2d9e4a1f5ab1cc.tar.gz kernel-qcow2-util-linux-3a7669aa8ab5c07044aea66c8e2d9e4a1f5ab1cc.tar.xz kernel-qcow2-util-linux-3a7669aa8ab5c07044aea66c8e2d9e4a1f5ab1cc.zip |
hwclock: remove set_system_clock_timezone()
Remove set_system_clock_timezone() because the previous patch
moved its functionality into set_system_clock().
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/hwclock.c | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index e49f1a153..ddd641327 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -641,95 +641,6 @@ set_system_clock(const struct hwclock_control *ctl, } /* - * Reset the System Clock from local time to UTC, based on its current value - * and the timezone unless universal is TRUE. - * - * Also set the kernel time zone value to the value indicated by the TZ - * environment variable and/or /usr/lib/zoneinfo/, interpreted as tzset() - * would interpret them. - * - * If 'testing' is true, don't actually update anything -- just say we would - * have. - */ -static int set_system_clock_timezone(const struct hwclock_control *ctl) -{ - int retcode; - struct timeval tv; - struct tm *broken; - int minuteswest; - - gettimeofday(&tv, NULL); - if (ctl->debug) { - struct tm broken_time; - char ctime_now[200]; - - broken_time = *gmtime(&tv.tv_sec); - strftime(ctime_now, sizeof(ctime_now), "%Y/%m/%d %H:%M:%S", - &broken_time); - printf(_("Current system time: %ld = %s\n"), tv.tv_sec, - ctime_now); - } - - broken = localtime(&tv.tv_sec); -#ifdef HAVE_TM_GMTOFF - minuteswest = -broken->tm_gmtoff / 60; /* GNU extension */ -#else - minuteswest = timezone / 60; - if (broken->tm_isdst) - minuteswest -= 60; -#endif - - if (ctl->debug) { - struct tm broken_time; - char ctime_now[200]; - - gettimeofday(&tv, NULL); - if (!ctl->universal) - tv.tv_sec += minuteswest * 60; - - broken_time = *gmtime(&tv.tv_sec); - strftime(ctime_now, sizeof(ctime_now), "%Y/%m/%d %H:%M:%S", - &broken_time); - - printf(_("Calling settimeofday:\n")); - printf(_("\tUTC: %s\n"), ctime_now); - printf(_("\ttv.tv_sec = %ld, tv.tv_usec = %ld\n"), - tv.tv_sec, tv.tv_usec); - printf(_("\ttz.tz_minuteswest = %d\n"), minuteswest); - } - if (ctl->testing) { - printf(_ - ("Test mode: clock was not changed\n")); - retcode = 0; - } else { - const struct timezone tz_utc = { 0, 0 }; - const struct timezone tz = { minuteswest, 0 }; - const struct timeval *tv_null = NULL; - int rc = 0; - - /* The first call to settimeofday after boot will assume the systemtime - * is in localtime, and adjust it according to the given timezone to - * compensate. If the systemtime is in fact in UTC, then this is wrong - * so we first do a dummy call to make sure the time is not shifted. - */ - if (ctl->universal) - rc = settimeofday(tv_null, &tz_utc); - - /* Now we set the real timezone. Due to the above dummy call, this will - * only warp the systemtime if the RTC is not in UTC. */ - if (!rc) - rc = settimeofday(tv_null, &tz); - - if (rc) { - warn(_("settimeofday() failed")); - retcode = 1; - } else - retcode = 0; - } - return retcode; -} - -/* * Refresh the last calibrated and last adjusted timestamps in <*adjtime_p> * to facilitate future drift calculations based on this set point. * |