summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-05-24 20:23:07 +0200
committerKay Sievers <kay.sievers@vrfy.org>2011-05-24 20:23:07 +0200
commit7948c4dfbea73ac21250b588089039aa17a90386 (patch)
treeaffd1ba0a14936f4c19452fd1219c8c65dc137fc /src/main.c
parent359306dfe552228716b8da5cf989da8d0e23a297 (diff)
rtc in localtime: use settimeofday(NULL, tz) instead of hwclock(8)
We check for LOCAL in /etc/adjtime and if needed, ask the kernel to apply the timezone delta to the system clock. The very first call of settimeofday() without a time, but a timezone warps the system clock, so that it properly runs in UTC.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 52b3031fbe..68328b76d3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1049,6 +1049,13 @@ int main(int argc, char *argv[]) {
if (label_init() < 0)
goto finish;
+
+ if (hwclock_is_localtime()) {
+ int min;
+
+ min = hwclock_apply_localtime_delta();
+ log_info("Hwclock configured in localtime, applying delta of %i minutes to system time", min);
+ }
} else {
arg_running_as = MANAGER_USER;
log_set_target(LOG_TARGET_CONSOLE);