Module Name:    src
Committed By:   kre
Date:           Wed Mar 22 18:17:42 UTC 2017

Modified Files:
        src/lib/libutil: parsedate.3 parsedate.y

Log Message:
parsedate.y:  meaningless KNF of a comment (no code changes)
parsedate.3:  add an item in BUGS noting the weirdness of "next"

The real purpose of this commit is to supply the following message
which should be used for the immediately previous commit, replacing
its commit message (the two are similar, but definitely not the
same).   With thanks to gdt@ for pointing out one of the (many) errors
in the previous message (and noting others I had already seen).

    ----

Make parsedate handle "12 noon" and "12 midnight" (including when the
time given is "12:00" or "12:00:00") - but only for exactly 12 o'clock.
"12:00:01" is am or pm, not noon or midnight.

"12 am" remains as an alias for "12 midnight", and "12 pm" for noon,
though both are strictly (pedanticly) invalid (and meaningless.)

Note that "12 midnight" (or "12 am") means 00:00:00 (ie: midnight at
the start of the day, not at the end.)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libutil/parsedate.3
cvs rdiff -u -r1.31 -r1.32 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.3
diff -u src/lib/libutil/parsedate.3:1.23 src/lib/libutil/parsedate.3:1.24
--- src/lib/libutil/parsedate.3:1.23	Wed Mar 22 01:49:36 2017
+++ src/lib/libutil/parsedate.3	Wed Mar 22 18:17:42 2017
@@ -1,4 +1,4 @@
-.\"     $NetBSD: parsedate.3,v 1.23 2017/03/22 01:49:36 kre Exp $
+.\"     $NetBSD: parsedate.3,v 1.24 2017/03/22 18:17:42 kre Exp $
 .\"
 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -417,4 +417,16 @@ but late 16th century is a rough guide)
 are suspicious at best,
 and depending upon context,
 often just plain wrong.
+.It 6
+Despite what is stated above,
+.Dq next
+is actually 2.
+The input
+.Dq "next January" ,
+instead of producing a timestamp for January of the
+following year, produces one for January 2nd, of the
+current year.
+Use caution with
+.Dq next
+it rarely does what humans expect.
 .El

Index: src/lib/libutil/parsedate.y
diff -u src/lib/libutil/parsedate.y:1.31 src/lib/libutil/parsedate.y:1.32
--- src/lib/libutil/parsedate.y:1.31	Wed Mar 22 01:49:36 2017
+++ src/lib/libutil/parsedate.y	Wed Mar 22 18:17:42 2017
@@ -14,7 +14,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __RCSID
-__RCSID("$NetBSD: parsedate.y,v 1.31 2017/03/22 01:49:36 kre Exp $");
+__RCSID("$NetBSD: parsedate.y,v 1.32 2017/03/22 18:17:42 kre Exp $");
 #endif
 
 #include <stdio.h>
@@ -659,14 +659,15 @@ RelVal(struct dateinfo *param, time_t v,
 	param->yyRel[i].yyRelVal = v;
 }
 
-
-/* Adjust year from a value that might be abbreviated, to a full value.
+/*
+ * Adjust year from a value that might be abbreviated, to a full value.
  * e.g. convert 70 to 1970.
  * Input Year is either:
  *  - A negative number, which means to use its absolute value (why?)
  *  - A number from 0 to 99, which means a year from 1900 to 1999, or
  *  - The actual year (>=100).
- * Returns the full year. */
+ * Returns the full year.
+ */
 static time_t
 AdjustYear(time_t Year)
 {

Reply via email to