summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c15
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
@@ -1319,17 +1319,26 @@ int main(int argc, char *argv[]) {
1319 if (label_init(NULL) < 0) 1319 if (label_init(NULL) < 0)
1320 goto finish; 1320 goto finish;
1321 1321
1322 if (!skip_setup) 1322 if (!skip_setup) {
1323 if (hwclock_is_localtime() > 0) { 1323 if (hwclock_is_localtime() > 0) {
1324 int min; 1324 int min;
1325 1325
1326 r = hwclock_apply_localtime_delta(&min); 1326 /* The first-time call to settimeofday() does a time warp in the kernel */
1327 r = hwclock_set_timezone(&min);
1327 if (r < 0) 1328 if (r < 0)
1328 log_error("Failed to apply local time delta, ignoring: %s", strerror(-r)); 1329 log_error("Failed to apply local time delta, ignoring: %s", strerror(-r));
1329 else 1330 else
1330 log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min); 1331 log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
1331 } 1332 } else {
1333 /* Do dummy first-time call to seal the kernel's time warp magic */
1334 hwclock_reset_timezone();
1332 1335
1336 /* Tell the kernel our time zone */
1337 r = hwclock_set_timezone(NULL);
1338 if (r < 0)
1339 log_error("Failed to set the kernel's time zone, ignoring: %s", strerror(-r));
1340 }
1341 }
1333 } else { 1342 } else {
1334 arg_running_as = MANAGER_USER; 1343 arg_running_as = MANAGER_USER;
1335 log_set_target(LOG_TARGET_AUTO); 1344 log_set_target(LOG_TARGET_AUTO);