diff options
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 44c010cfb..199383e63 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1321,3 +1321,3 @@ int main(int argc, char *argv[]) { - if (!skip_setup) + if (!skip_setup) { if (hwclock_is_localtime() > 0) { @@ -1325,3 +1325,4 @@ int main(int argc, char *argv[]) { - 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) @@ -1330,4 +1331,12 @@ int main(int argc, char *argv[]) { 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 { |