diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-07-21 20:28:27 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-07-21 20:28:27 +0200 |
commit | ff4daf5a348278abed4dbf8afc3c4297b8cb9877 (patch) | |
tree | a9940950447c6ed8b4412d2bb4201df449d9fff1 /src/util.c | |
parent | f68c5a70762da0cbb6228d05a87254a7c6c46ba6 (diff) |
fix hwclock_apply_localtime_delta() to properly handle negative TZ offset
Localtime may be a negative number, i.e. GMT-7. Fix based on a
patch from Kelly Anderson <kelly@silka.with-linux.com>.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c index a0fbdc517e..3187ec3768 100644 --- a/src/util.c +++ b/src/util.c @@ -4905,7 +4905,7 @@ int hwclock_is_localtime(void) { return local; } -int hwclock_apply_localtime_delta(void) { +int hwclock_apply_localtime_delta(int *min) { const struct timeval *tv_null = NULL; struct timespec ts; struct tm *tm; @@ -4926,8 +4926,9 @@ int hwclock_apply_localtime_delta(void) { */ if (settimeofday(tv_null, &tz) < 0) return -errno; - - return minuteswest; + if (min) + *min = minuteswest; + return 0; } int hwclock_reset_localtime_delta(void) { |