From: Scott James Remnant Date: Thu, 24 Sep 2009 19:17:23 +0000 (-0700) Subject: hwclock: set kernel timezone with --systz --utc X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=583f03f77a3d85380b801960b0458fe75d477468;p=util-linux hwclock: set kernel timezone with --systz --utc Even though --systz doesn't need to change the system clock when the hardware clock is in UTC time (--systz --utc), it does need to set the kernel timezone so that FAT timestamps, etc. will be correct. Signed-off-by: Scott James Remnant --- diff --git a/hwclock/hwclock.c b/hwclock/hwclock.c index 29e6eb2b..ac50b7ec 100644 --- a/hwclock/hwclock.c +++ b/hwclock/hwclock.c @@ -754,10 +754,10 @@ set_system_clock(const bool hclock_valid, const time_t newtime, static int -set_system_clock_timezone(const bool testing) { +set_system_clock_timezone(const bool universal, const bool testing) { /*---------------------------------------------------------------------------- Reset the System Clock from local time to UTC, based on its current - value and the timezone. + 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 @@ -792,7 +792,8 @@ set_system_clock_timezone(const bool testing) { #endif gettimeofday(&tv, NULL); - tv.tv_sec += minuteswest * 60; + if (!universal) + tv.tv_sec += minuteswest * 60; if (debug) { struct tm broken_time; @@ -1222,14 +1223,10 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile, return rc; } } else if (systz) { - if (!universal) { - rc = set_system_clock_timezone(testing); - if (rc) { - printf(_("Unable to set system clock.\n")); - return rc; - } - } else if (debug) { - printf(_("Clock in UTC, not changed.\n")); + rc = set_system_clock_timezone(universal, testing); + if (rc) { + printf(_("Unable to set system clock.\n")); + return rc; } } if (!noadjfile)