Re: Bug in /usr/local/lib/perl5/site_perl/HTTP/Date.pm near line 268 or 278

Vince Del Vecchio (vince.delvecchio@analog.com)
Tue, 18 Mar 1997 10:52:09 -0500


>>>>> On Mon, 17 Mar 1997 19:34:21 -0700,
   Tom Christiansen <tchrist@jhereg.perl.com> said:

> The code you posted is interesting, but please let's be careful when
> applying fixes.  It's more complicated than how you've portrayed it.

Actually, I don't think it is.

> I point this out because many non-anglophones, especially
> Europeans, are often confused by am/pm notation as it relates
> to the boundary conditions:

And apparently some anglophones as well, since your chart is incorrect.
Noon is 12:00pm, not am, and midnight is 12:00am.  So I think that the
modified code is probably right.

For example, consider the following:

#!/usr/local/bin/perl
use POSIX;
for (000, 001, 100, 1159, 1200, 1201, 1300, 2359) {
  print strftime("%R   %r\n", 0, $_ % 100, $_ / 100, 1, 0, 70);
}

which produces the following output:

00:00   12:00:00 AM
00:01   12:01:00 AM
01:00   01:00:00 AM
11:59   11:59:00 AM
12:00   12:00:00 PM
12:01   12:01:00 PM
13:00   01:00:00 PM
23:59   11:59:00 PM

So this is basically consistent with military notation,
except that 12 is used instead of 0.

When thinking about the boundary conditions, remember that midnight is
not really a second.  It is really a point in time, 00:00:00, and as
such has no duration.  It seems clear that the open interval
representing the second after midnight, that is, (00:00:00, 00:00:01),
must belong to the new day, just as the second before, (23:59:59,
00:00:00) belonged to the old.  It is true that we also want to decide
which day midnight itself is in by making one of those a half-closed
interval.  The numbering (in both US AM/PM and 24-hour) makes it seem
more reasonable to say that midnight is in the new day.  So we say that
the interval [00:00:00, 00:00:01), which is probably what people mean by
midnight when they think it is a second, is in the new day.

Note that, for reasons I have never exactly understood, centuries and
millenia (and decades?) work differently, more as you described.
So, as I understand it, the year 2000 will be in the 20th century, and
only in 2001 will the 21st century begin.  I think this has something
to do with the fact that the people coming up with the CE calendar
called the year of Christ's birth 1 rather than 0.

-Vince Del Vecchio
vince.delvecchio@analog.com