* On 2002.03.27, in <[EMAIL PROTECTED]>,
*       "Mark J. Reed" <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 28, 2002 at 02:07:59AM +0100, Sven Guckes wrote:
> > 
> >   $ TIMEFMT="%D" ./timediff "4/6/67" "3/28/02"
> >   Difference is 11773.96 days.
> Besides the fraction, that's just plain wrong.
> 1967-04-06 to 2002-03-28 is 12,775 days.  Maybe
> your %D is not the same as his %D?  Where did 'timediff' come from?

I made timediff up on request.

The problem here is probably that the calculations are based on "unix
time" -- the seconds since 1/1/1970, midnight GMT. The program just
doesn't have good error checking, since it was such a quickie.

shell$ env TZ=GMT perl -e 'require "ctime.pl";$t = 0x7fffffff; print ctime($t);'
Tue Jan 19  3:14:07 GMT 2038

shell$ env TIMEFMT="%m/%d/%Y %H:%M:%S" ./timediff "1/19/2038 3:14:07" "3/28/2002 
00:00:00"
Difference is 11774.25 days.

Pretty close to Sven's example. Artifacts of the absolution of |t1-t2|,
and the fact that strptime() can't make much of a pre-1970 date, because
it has to convert it into post-1970 structures.

-- 
 -D.    [EMAIL PROTECTED]        NSIT    University of Chicago

Reply via email to