Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libutil parsedate.y: meaningless KNF of a comment (no c...



details:   https://anonhg.NetBSD.org/src/rev/399a784c44ad
branches:  trunk
changeset: 352239:399a784c44ad
user:      kre <kre%NetBSD.org@localhost>
date:      Wed Mar 22 18:17:42 2017 +0000

description:
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.)

diffstat:

 lib/libutil/parsedate.3 |  14 +++++++++++++-
 lib/libutil/parsedate.y |   9 +++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r 103d6adff3f9 -r 399a784c44ad lib/libutil/parsedate.3
--- a/lib/libutil/parsedate.3   Wed Mar 22 17:52:36 2017 +0000
+++ b/lib/libutil/parsedate.3   Wed Mar 22 18:17:42 2017 +0000
@@ -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 @@
 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
diff -r 103d6adff3f9 -r 399a784c44ad lib/libutil/parsedate.y
--- a/lib/libutil/parsedate.y   Wed Mar 22 17:52:36 2017 +0000
+++ b/lib/libutil/parsedate.y   Wed Mar 22 18:17:42 2017 +0000
@@ -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 @@
        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)
 {



Home | Main Index | Thread Index | Old Index