summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-09-17 16:41:13 +0200
committerKay Sievers <kay@vrfy.org>2012-09-17 16:56:26 +0200
commit72edcff5db936e54cfc322d9392ec46e2428fd9b (patch)
tree2de5e6ba1b02e2b6db42ad3ab99c0907cfcf6285 /src/shared
parent4096d6f5879aef73e20dd7b62a01f447629945b0 (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/shared')
-rw-r--r--src/shared/hwclock.c9
-rw-r--r--src/shared/hwclock.h4
2 files changed, 9 insertions, 4 deletions
diff --git a/src/shared/hwclock.c b/src/shared/hwclock.c
index 9f8ab08e2b..d9d5600ff3 100644
--- a/src/shared/hwclock.c
+++ b/src/shared/hwclock.c
@@ -188,7 +188,7 @@ int hwclock_is_localtime(void) {
return local;
}
-int hwclock_apply_localtime_delta(int *min) {
+int hwclock_set_timezone(int *min) {
const struct timeval *tv_null = NULL;
struct timespec ts;
struct tm *tm;
@@ -214,13 +214,18 @@ int hwclock_apply_localtime_delta(int *min) {
return 0;
}
-int hwclock_reset_localtime_delta(void) {
+int hwclock_reset_timezone(void) {
const struct timeval *tv_null = NULL;
struct timezone tz;
tz.tz_minuteswest = 0;
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 time zone with next call.
+ */
if (settimeofday(tv_null, &tz) < 0)
return -errno;
diff --git a/src/shared/hwclock.h b/src/shared/hwclock.h
index 26d1b444e7..b2bdc78f0c 100644
--- a/src/shared/hwclock.h
+++ b/src/shared/hwclock.h
@@ -23,8 +23,8 @@
***/
int hwclock_is_localtime(void);
-int hwclock_apply_localtime_delta(int *min);
-int hwclock_reset_localtime_delta(void);
+int hwclock_set_timezone(int *min);
+int hwclock_reset_timezone(void);
int hwclock_get_time(struct tm *tm);
int hwclock_set_time(const struct tm *tm);