diff options
author | Scott James Remnant | 2009-09-24 21:17:23 +0200 |
---|---|---|
committer | Karel Zak | 2009-10-13 16:17:51 +0200 |
commit | 2eefcaaace7e07eabf4dc054d33f9e0fb1a2d6d8 (patch) | |
tree | bbe973d31fbfe882ddbd9c571c0b14fe5bf05e4b /hwclock/hwclock.c | |
parent | tests: swapon workaround for libtool wrapper (diff) | |
download | kernel-qcow2-util-linux-2eefcaaace7e07eabf4dc054d33f9e0fb1a2d6d8.tar.gz kernel-qcow2-util-linux-2eefcaaace7e07eabf4dc054d33f9e0fb1a2d6d8.tar.xz kernel-qcow2-util-linux-2eefcaaace7e07eabf4dc054d33f9e0fb1a2d6d8.zip |
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 <scott@ubuntu.com>
Diffstat (limited to 'hwclock/hwclock.c')
-rw-r--r-- | hwclock/hwclock.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/hwclock/hwclock.c b/hwclock/hwclock.c index 9cdadfea6..c07f75795 100644 --- a/hwclock/hwclock.c +++ b/hwclock/hwclock.c @@ -753,10 +753,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 @@ -791,7 +791,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; @@ -1221,14 +1222,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) |