summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-27 10:44:23 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-27 10:44:23 +0000
commitbb05bcde0173ef3d53b0604cfda2e7624b897990 (patch)
tree9311f96f78d310968eb81985b10b76171e1a3f1b /ext/date
parent264b4150eba773d06f638f86ef733b1cb5293d8d (diff)
* ext/date/date_strptime.c (date__strptime_internal): do not overwrite century.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/date_strptime.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c
index 3e1b0f8..e318af1 100644
--- a/ext/date/date_strptime.c
+++ b/ext/date/date_strptime.c
@@ -291,8 +291,9 @@ date__strptime_internal(const char *str, size_t slen,
if (!valid_range_p(n, 0, 99))
fail();
set_hash("cwyear",n);
- set_hash("_cent",
- INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
+ if (NIL_P(ref_hash("_cent")))
+ set_hash("_cent",
+ INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
goto matched;
}
@@ -556,8 +557,9 @@ date__strptime_internal(const char *str, size_t slen,
if (sign == -1)
n = f_negate(n);
set_hash("year", n);
- set_hash("_cent",
- INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
+ if (NIL_P(ref_hash("_cent")))
+ set_hash("_cent",
+ INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
goto matched;
}