[git commit branch/0.9.32] libc: fix daylight saving time handling

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Oct 12 11:28:18 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=733aeae80de66a6c443e4171dbefa8b266cb806a
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/0.9.32

The algorithm computing daylight saving time incorrectly adds a day for
each month after January for leap years. The clock shift from/to DST can
be delayed if the last Sunday of a transition month is exactly seven
days before the first of the following month.

This change adds a day for the February month only.

Signed-off-by: Guillaume Bourcier <guillaumebourcier at free.fr>
Signed-off-by: Richard Braun <rbraun at sceen.net>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libc/misc/time/time.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index 19d68e1..8e2ebf1 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -689,7 +689,7 @@ static int tm_isdst(register const struct tm *__restrict ptm,
 					++day;
 				}
 				monlen = 31 + day_cor[r->month -1] - day_cor[r->month];
-				if (isleap && (r->month > 1)) {
+				if (isleap && (r->month == 2)) {
 					++monlen;
 				}
 				/* Wweekday (0 is Sunday) of 1st of the month


More information about the uClibc-cvs mailing list