Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libutil - fix off by one in comparison with 69 (it shoul...
details: https://anonhg.NetBSD.org/src/rev/c3bfbd5fe509
branches: trunk
changeset: 759933:c3bfbd5fe509
user: christos <christos%NetBSD.org@localhost>
date: Tue Dec 21 00:14:10 2010 +0000
description:
- 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
diffstat:
lib/libutil/parsedate.y | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diffs (70 lines):
diff -r a4d6833e9458 -r c3bfbd5fe509 lib/libutil/parsedate.y
--- a/lib/libutil/parsedate.y Mon Dec 20 23:48:25 2010 +0000
+++ b/lib/libutil/parsedate.y Tue Dec 21 00:14:10 2010 +0000
@@ -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;
Home |
Main Index |
Thread Index |
Old Index