From 3a7669aa8ab5c07044aea66c8e2d9e4a1f5ab1cc Mon Sep 17 00:00:00 2001 From: J William Piggott Date: Sun, 6 Aug 2017 12:17:10 -0400 Subject: 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 --- sys-utils/hwclock.c | 89 ----------------------------------------------------- 1 file changed, 89 deletions(-) (limited to 'sys-utils/hwclock.c') 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 @@ -640,95 +640,6 @@ set_system_clock(const struct hwclock_control *ctl, return retcode; } -/* - * 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. -- cgit v1.2.3-55-g7522