]> sourceware.org Git - newlib-cygwin.git/commitdiff
* libc/time/strftime.c (get_era_info): Fix off-by-one error in month
authorCorinna Vinschen <corinna@vinschen.de>
Mon, 12 Dec 2011 10:48:29 +0000 (10:48 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 12 Dec 2011 10:48:29 +0000 (10:48 +0000)
calculation.

newlib/ChangeLog
newlib/libc/time/strftime.c

index e1007479e7147e6d4cf805cbe8e9c1e65cc380ef..dccc4f2726685d411ae71178e364b75ab217306e 100644 (file)
@@ -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.
index f4704b62d701862d9e8397552e7b3c2decbbde77..840e310db2cfa9ad1af94ce841ae6bca8c4f5bbf 100644 (file)
@@ -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;
This page took 0.05248 seconds and 5 git commands to generate.