diff options
author | Kay Sievers <kay@vrfy.org> | 2014-07-27 00:11:08 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2014-07-27 10:44:31 +0200 |
commit | c264aeab4b0e7b69f469e12e78d4a48b3ed7a66e (patch) | |
tree | a99191d8ebde57537e362f6053074609bf19d7cc /src/shared/clock-util.c | |
parent | c6a373a26348544d944b08bf0c5dea4f72f6980b (diff) |
core: only set the kernel's timezone when the RTC runs in local time
We can not reliably manage any notion of local time. Every daylight
saving time change or time zone change by traveling will make the
time jump, and the local time might jump backwards which creates
unsolvable problems with file timestamps.
We will no longer tell the kernel our local time zone and leave
everything set to UTC. This will effectively turn FAT timestamps
into UTC timestamps.
If and only if the machine is configured to read the RTC in local
time mode, the kernel's time zone will be configured, but
systemd-timesysnc will disable the kernel's system time to RTC
syncing. In this mode, the RTC will not be managed, and external
tools like Windows bootups are expected to manage the RTC's time.
https://bugs.freedesktop.org/show_bug.cgi?id=81538
Diffstat (limited to 'src/shared/clock-util.c')
-rw-r--r-- | src/shared/clock-util.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/shared/clock-util.c b/src/shared/clock-util.c index e66db63ba0..fc49393c72 100644 --- a/src/shared/clock-util.c +++ b/src/shared/clock-util.c @@ -124,9 +124,10 @@ int clock_set_timezone(int *min) { tz.tz_dsttime = 0; /* DST_NONE*/ /* - * If the hardware clock does not run in UTC, but in local time: - * The very first time we set the kernel's timezone, it will warp - * the clock so that it runs in UTC instead of local time. + * If the RTC does not run in UTC but in local time, the very first + * call to settimeofday() will set the kernel's timezone and will warp the + * system clock, so that it runs in UTC instead of the local time we + * have read from the RTC. */ if (settimeofday(tv_null, &tz) < 0) return -errno; @@ -135,7 +136,7 @@ int clock_set_timezone(int *min) { return 0; } -int clock_reset_timezone(void) { +int clock_reset_timewarp(void) { const struct timeval *tv_null = NULL; struct timezone tz; @@ -143,9 +144,9 @@ int clock_reset_timezone(void) { tz.tz_dsttime = 0; /* DST_NONE*/ /* - * The very first time we set the kernel's timezone, it will warp - * the clock. Do a dummy call here, so the time warping is sealed - * and we set only the timezone with the next call. + * The very first call to settimeofday() does time warp magic. Do a + * dummy call here, so the time warping is sealed and all later calls + * behave as expected. */ if (settimeofday(tv_null, &tz) < 0) return -errno; |