summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2013-12-04 13:53:13 +0100
committerOndřej Bílka <neleai@seznam.cz>2013-12-04 13:53:13 +0100
commit19e3372ba4538f85b6c73361feaf408ae0e65ebe (patch)
treeeb1dd8fcbc517fbfd6ae173bc970db7d5447c3ee /time
parentecaf142d3d70630a0d7f028d334b5339ff2b996d (diff)
downloadglibc-19e3372ba4538f85b6c73361feaf408ae0e65ebe.tar.gz
Allow strptime read outputs from strftime. Fixes bug 4772.
Diffstat (limited to 'time')
-rw-r--r--time/strptime_l.c19
-rw-r--r--time/tst-strptime.c2
2 files changed, 10 insertions, 11 deletions
diff --git a/time/strptime_l.c b/time/strptime_l.c
index c2c2ee83c5..b9a8e144fe 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -320,17 +320,14 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
}
++fmt;
- if (statep != NULL)
- {
- /* In recursive calls silently discard strftime modifiers. */
- while (*fmt == '-' || *fmt == '_' || *fmt == '0'
- || *fmt == '^' || *fmt == '#')
- ++fmt;
-
- /* And field width. */
- while (*fmt >= '0' && *fmt <= '9')
- ++fmt;
- }
+ /* We discard strftime modifiers. */
+ while (*fmt == '-' || *fmt == '_' || *fmt == '0'
+ || *fmt == '^' || *fmt == '#')
+ ++fmt;
+
+ /* And field width. */
+ while (*fmt >= '0' && *fmt <= '9')
+ ++fmt;
#ifndef _NL_CURRENT
/* We need this for handling the `E' modifier. */
diff --git a/time/tst-strptime.c b/time/tst-strptime.c
index 193f7dbe0e..5c5fa7b805 100644
--- a/time/tst-strptime.c
+++ b/time/tst-strptime.c
@@ -41,6 +41,8 @@ static const struct
{ "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 },
{ "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 },
{ "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 },
+ { "C", "2001 21 Mon", "%2000Y %W %a", 1, 140, 4, 21 },
+ { "C", "2001 21 Mon", "%^Y %W %a", 1, 140, 4, 21 },
{ "C", "2001 EST 21 Mon", "%Y %Z %W %a", 1, 140, 4, 21 },
{ "C", "2012 00 Sun", "%Y %W %a", 0, 0, 0, 1 },
{ "ja_JP.EUC-JP", "2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p",