Skip to content

Commit

Permalink
date.c: fix parsing of dates in mm/dd/yy format
Browse files Browse the repository at this point in the history
We looked at the year one character too early, and we
didn't accept a two-character year date after 2000.
  • Loading branch information
Linus Torvalds committed Apr 30, 2005
1 parent eaa8512 commit a905888
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion date.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,11 @@ static int match_digit(char *date, struct tm *tm, int *offset)
tm->tm_mon = num - 1;
tm->tm_mday = num2;
if (*end == c && isdigit(end[1])) {
num3 = strtoul(end, &end, 10);
num3 = strtoul(end+1, &end, 10);
if (num3 > 1900)
num3 -= 1900;
else if (num3 < 38)
num3 += 100;
tm->tm_year = num3;
}
break;
Expand Down

0 comments on commit a905888

Please sign in to comment.