diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2011-12-12 10:48:29 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2011-12-12 10:48:29 +0000 |
commit | 74e0bcfc0f3fc3c38941675d2338b3d11f41989a (patch) | |
tree | f370e2137bee45d3a257447729f0be224f50507c | |
parent | cdce73f183d46a202c632486d5bd82d515cb05be (diff) | |
download | newlib-74e0bcfc0f3fc3c38941675d2338b3d11f41989a.zip newlib-74e0bcfc0f3fc3c38941675d2338b3d11f41989a.tar.gz newlib-74e0bcfc0f3fc3c38941675d2338b3d11f41989a.tar.bz2 |
* libc/time/strftime.c (get_era_info): Fix off-by-one error in month
calculation.
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/time/strftime.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index e100747..dccc4f2 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2011-12-12 Akio Idehara <zbe64533@gmail.com> + + * libc/time/strftime.c (get_era_info): Fix off-by-one error in month + calculation. + 2011-12-06 Chris Johns <chrisj@rtems.org> * libc/iconv/Makefile.am (stmp-def): Use $(MAKE) rather than make. diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c index f4704b6..840e310 100644 --- a/newlib/libc/time/strftime.c +++ b/newlib/libc/time/strftime.c @@ -426,7 +426,7 @@ get_era_info (const struct tm *tim_p, const char *era) /* Adjust offset for negative gregorian dates. */ if (stm.tm_year <= -YEAR_BASE) ++stm.tm_year; - stm.tm_mon = ERA_STRTOL (c + 1, &c, 10); + stm.tm_mon = ERA_STRTOL (c + 1, &c, 10) - 1; stm.tm_mday = ERA_STRTOL (c + 1, &c, 10); stm.tm_hour = stm.tm_min = stm.tm_sec = 0; era = c + 1; @@ -440,7 +440,7 @@ get_era_info (const struct tm *tim_p, const char *era) else if (era[0] == '+' && era[1] == '*') { etm.tm_year = INT_MAX; - etm.tm_mon = 12; + etm.tm_mon = 11; etm.tm_mday = 31; etm.tm_hour = 23; etm.tm_min = etm.tm_sec = 59; @@ -452,7 +452,7 @@ get_era_info (const struct tm *tim_p, const char *era) /* Adjust offset for negative gregorian dates. */ if (etm.tm_year <= -YEAR_BASE) ++etm.tm_year; - etm.tm_mon = ERA_STRTOL (c + 1, &c, 10); + etm.tm_mon = ERA_STRTOL (c + 1, &c, 10) - 1; etm.tm_mday = ERA_STRTOL (c + 1, &c, 10); etm.tm_mday = 31; etm.tm_hour = 23; |