diff options
Diffstat (limited to 'util-linux/hwclock.c')
| -rw-r--r-- | util-linux/hwclock.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index 379eeb253..3f531555b 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c | |||
| @@ -97,7 +97,11 @@ static void to_sys_clock(const char **pp_rtcname, int utc) | |||
| 97 | struct timeval tv; | 97 | struct timeval tv; |
| 98 | struct timezone tz; | 98 | struct timezone tz; |
| 99 | 99 | ||
| 100 | tz.tz_minuteswest = timezone/60 - 60*daylight; | 100 | tz.tz_minuteswest = timezone/60; |
| 101 | /* ^^^ used to also subtract 60*daylight, but it's wrong: | ||
| 102 | * daylight!=0 means "this timezone has some DST | ||
| 103 | * during the year", not "DST is in effect now". | ||
| 104 | */ | ||
| 101 | tz.tz_dsttime = 0; | 105 | tz.tz_dsttime = 0; |
| 102 | 106 | ||
| 103 | tv.tv_sec = read_rtc(pp_rtcname, NULL, utc); | 107 | tv.tv_sec = read_rtc(pp_rtcname, NULL, utc); |
| @@ -248,7 +252,7 @@ static void set_system_clock_timezone(int utc) | |||
| 248 | gettimeofday(&tv, NULL); | 252 | gettimeofday(&tv, NULL); |
| 249 | broken = localtime(&tv.tv_sec); | 253 | broken = localtime(&tv.tv_sec); |
| 250 | tz.tz_minuteswest = timezone / 60; | 254 | tz.tz_minuteswest = timezone / 60; |
| 251 | if (broken->tm_isdst) | 255 | if (broken->tm_isdst > 0) |
| 252 | tz.tz_minuteswest -= 60; | 256 | tz.tz_minuteswest -= 60; |
| 253 | tz.tz_dsttime = 0; | 257 | tz.tz_dsttime = 0; |
| 254 | gettimeofday(&tv, NULL); | 258 | gettimeofday(&tv, NULL); |
| @@ -305,6 +309,10 @@ int hwclock_main(int argc UNUSED_PARAM, char **argv) | |||
| 305 | ; | 309 | ; |
| 306 | applet_long_options = hwclock_longopts; | 310 | applet_long_options = hwclock_longopts; |
| 307 | #endif | 311 | #endif |
| 312 | |||
| 313 | /* Initialize "timezone" (libc global variable) */ | ||
| 314 | tzset(); | ||
| 315 | |||
| 308 | opt_complementary = "r--wst:w--rst:s--wrt:t--rsw:l--u:u--l"; | 316 | opt_complementary = "r--wst:w--rst:s--wrt:t--rsw:l--u:u--l"; |
| 309 | opt = getopt32(argv, "lurswtf:", &rtcname); | 317 | opt = getopt32(argv, "lurswtf:", &rtcname); |
| 310 | 318 | ||
