Module Name: src
Committed By: christos
Date: Tue Dec 21 00:14:10 UTC 2010
Modified Files:
src/lib/libutil: parsedate.y
Log Message:
- document limitations
- add synonyms for the numbers
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libutil/parsedate.y
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libutil/parsedate.y
diff -u src/lib/libutil/parsedate.y:1.6 src/lib/libutil/parsedate.y:1.7
--- src/lib/libutil/parsedate.y:1.6 Sun Dec 12 13:39:57 2010
+++ src/lib/libutil/parsedate.y Mon Dec 20 19:14:10 2010
@@ -161,7 +161,7 @@
yyMinutes = tmbuf.tm_min;
yySeconds = tmbuf.tm_sec;
} else {
- yyYear = 1970;
+ yyYear = EPOCH;
yyMonth = 1;
yyDay = 1;
@@ -207,6 +207,15 @@
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 @@
{ "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 @@
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;