aboutsummaryrefslogtreecommitdiff
path: root/time/strptime_l.c
diff options
context:
space:
mode:
Diffstat (limited to 'time/strptime_l.c')
-rw-r--r--time/strptime_l.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/time/strptime_l.c b/time/strptime_l.c
index e19b9a15dd..7436a168b7 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -907,10 +907,15 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tmp,
{
int delta = ((tm->tm_year - era->offset)
* era->absolute_direction);
+ /* The difference between two sets of years
+ does not include the final year itself,
+ therefore add 1 to the difference to
+ account for that final year. */
match = (delta >= 0
&& delta < (((int64_t) era->stop_date[0]
- (int64_t) era->start_date[0])
- * era->absolute_direction));
+ * era->absolute_direction
+ + 1));
}
if (! match)
return NULL;
@@ -928,10 +933,12 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tmp,
{
int delta = ((tm->tm_year - era->offset)
* era->absolute_direction);
+ /* See comment above about year difference + 1. */
if (delta >= 0
&& delta < (((int64_t) era->stop_date[0]
- (int64_t) era->start_date[0])
- * era->absolute_direction))
+ * era->absolute_direction
+ + 1))
{
s.decided = loc;
break;