NetBSD-Bugs archive

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

Re: bin/50574 (lib/libutil/t_parsedate:relative test fails at times)



The following reply was made to PR bin/50574; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/50574 (lib/libutil/t_parsedate:relative test fails at times)
Date: Mon, 02 May 2016 14:06:55 +0700

     Date:        Sun,  1 May 2016 16:42:54 +0000 (UTC)
     From:        gson%NetBSD.org@localhost
     Message-ID:  <20160501164254.2CA347A64F%mollari.NetBSD.org@localhost>
 
   | The problem has recurred, and the test now reproduces it consistently.
 
 I think I have some patches (for parsedate, and the tests) that
 will make the tests work, and parsedate a little more rational in
 some cases (and also a little more flexible, though probably not
 in ways anyone will notice, I expect.)
 
 I am testing now (well, building so I can test.)  After I have
 verified success (or fixed whatever is not successful) I will
 send patches.
 
 One thing I have not yet done, but am seriously considering, is
 changing "next" from 2 to 1.   To understand what this means it
 is necessary first to understand that in parsedate, everything
 (except fillers, like spaces, and colons, etc) is a scaled typed number.
 The types are things like "relative seconds", "absolute day", ...
 "next" is simply "2" (an ordinary integer)  (for comparison, "this" is 0,
 and "last" is -1).
 
 That's because even though it might make sense (today, Monday May 2) for
 "next Tuesday" to be Tuesday May 10 (rather than tomorrow, May 3),
 it makes very little sense for "next year" to be May 2, 2018 (which is
 how it is currently interpreted - that is, effectively, "+ 2 year".
 
 [Aside: this parsig method has some strange artifacts, "next yesterday"
 means "2 days ago" because "next" is 2, and "yesterday is "-1 day", and
 adjacent numbers are multiplied, similarly "last yesterday" is the same
 as "tomorrow" (-1 * -1 day == +1 day).]
 
 The downside of the change wold be that "next Monday" (uttered today)
 would become Mon May 2 (ie: today), which is rarely what is intended,
 whereas as things are now, it means Mon May 9 (same as 2 Monday).
 
 Getting all of this "right" would mean huge changes to the (very simple)
 parser that is parsedate, and complicate it greatly.   So I am seeking
 opinions on which is more important to work naturally, and until we
 work out what "next xxx" really should mean, I will not change it.
 
 kre
 
 


Home | Main Index | Thread Index | Old Index