- fix off by one in comparison with 69 (it should be 70)

- add aliases for 1 (one), 2 (two), etc.
- allow parsing of HH:MM:SS.sss as the man page mentions, and ignore sss
This commit is contained in:
christos 2010-12-21 00:14:10 +00:00
parent 7d82dd048e
commit 2e63e08217

View File

@ -161,7 +161,7 @@ epochdate: AT_SIGN tUNUMBER {
yyMinutes = tmbuf.tm_min;
yySeconds = tmbuf.tm_sec;
} else {
yyYear = 1970;
yyYear = EPOCH;
yyMonth = 1;
yyDay = 1;
@ -207,6 +207,15 @@ time : tUNUMBER tMERIDIAN {
yyDSTmode = DSToff;
yyTimezone = - ($6 % 100 + ($6 / 100) * 60);
}
| tUNUMBER ':' tUNUMBER ':' tUNUMBER '.' tUNUMBER {
yyHour = $1;
yyMinutes = $3;
yySeconds = $5;
yyMeridian = MER24;
yyDSTmode = DSToff;
/* XXX: Do nothing with millis */
/* yyTimezone = ($7 % 100 + ($7 / 100) * 60); */
}
;
zone : tZONE {
@ -412,17 +421,29 @@ static TABLE const OtherTable[] = {
{ "this", tMINUTE_UNIT, 0 },
{ "next", tUNUMBER, 2 },
{ "first", tUNUMBER, 1 },
{ "one", tUNUMBER, 1 },
/* { "second", tUNUMBER, 2 }, */
{ "two", tUNUMBER, 2 },
{ "third", tUNUMBER, 3 },
{ "three", tUNUMBER, 3 },
{ "fourth", tUNUMBER, 4 },
{ "four", tUNUMBER, 4 },
{ "fifth", tUNUMBER, 5 },
{ "five", tUNUMBER, 5 },
{ "sixth", tUNUMBER, 6 },
{ "six", tUNUMBER, 6 },
{ "seventh", tUNUMBER, 7 },
{ "seven", tUNUMBER, 7 },
{ "eighth", tUNUMBER, 8 },
{ "eight", tUNUMBER, 8 },
{ "ninth", tUNUMBER, 9 },
{ "nine", tUNUMBER, 9 },
{ "tenth", tUNUMBER, 10 },
{ "ten", tUNUMBER, 10 },
{ "eleventh", tUNUMBER, 11 },
{ "eleven", tUNUMBER, 11 },
{ "twelfth", tUNUMBER, 12 },
{ "twelve", tUNUMBER, 12 },
{ "ago", tAGO, 1 },
{ NULL, 0, 0 }
};
@ -616,9 +637,10 @@ Convert(
time_t Julian, oJulian;
int i;
/* XXX Y2K */
if (Year < 0)
Year = -Year;
if (Year < 69)
if (Year < 70)
Year += 2000;
else if (Year < 100)
Year += 1900;