summaryrefslogtreecommitdiff
path: root/libc/misc/time/time.c
diff options
context:
space:
mode:
authorGuillaume Bourcier <guillaumebourcier@free.fr>2011-10-11 11:45:33 (GMT)
committerCarmelo Amoroso <carmelo.amoroso@st.com>2011-10-12 11:23:13 (GMT)
commit47f3da1cf49377c25772bb54d07db55225bbb142 (patch)
treeb5d0a9528094253e9feba102a74b3238b22dc852 /libc/misc/time/time.c
parent7eaca202b9f1f79a3c1d2a56a3879364cfa89e42 (diff)
downloaduClibc-47f3da1cf49377c25772bb54d07db55225bbb142.tar.gz
uClibc-47f3da1cf49377c25772bb54d07db55225bbb142.tar.bz2
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>
Diffstat (limited to 'libc/misc/time/time.c')
-rw-r--r--libc/misc/time/time.c2
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