diff options
author | Kay Sievers <kay@vrfy.org> | 2012-09-17 16:41:13 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-09-17 16:56:26 +0200 |
commit | 72edcff5db936e54cfc322d9392ec46e2428fd9b (patch) | |
tree | 2de5e6ba1b02e2b6db42ad3ab99c0907cfcf6285 /src/core/main.c | |
parent | 4096d6f5879aef73e20dd7b62a01f447629945b0 (diff) |
hwclock: always set the kernel's timezone
Properly tell the kernel at bootup, and any later time zone changes,
the actual system time zone.
Things like the kernel's FAT filesystem driver needs the actual time
zone to calculate the proper local time to use for the on-disk time
stamps.
https://bugzilla.redhat.com/show_bug.cgi?id=802198
Diffstat (limited to 'src/core/main.c')
-rw-r--r-- | src/core/main.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/core/main.c b/src/core/main.c index 44c010cfbf..199383e636 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1319,17 +1319,26 @@ int main(int argc, char *argv[]) { if (label_init(NULL) < 0) goto finish; - if (!skip_setup) + if (!skip_setup) { if (hwclock_is_localtime() > 0) { int min; - r = hwclock_apply_localtime_delta(&min); + /* The first-time call to settimeofday() does a time warp in the kernel */ + r = hwclock_set_timezone(&min); if (r < 0) log_error("Failed to apply local time delta, ignoring: %s", strerror(-r)); else log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min); - } + } else { + /* Do dummy first-time call to seal the kernel's time warp magic */ + hwclock_reset_timezone(); + /* Tell the kernel our time zone */ + r = hwclock_set_timezone(NULL); + if (r < 0) + log_error("Failed to set the kernel's time zone, ignoring: %s", strerror(-r)); + } + } } else { arg_running_as = MANAGER_USER; log_set_target(LOG_TARGET_AUTO); |