Browse Source

libc: fix daylight saving time handling

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@free.fr>
Signed-off-by: Richard Braun <rbraun@sceen.net>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Guillaume Bourcier 12 years ago
parent
commit
47f3da1cf4
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libc/misc/time/time.c

+ 1 - 1
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