[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] MacPerl & Netscape history files...



At 10:43 PM -0500 3/8/98, Lars Kellogg-Stedman wrote:

>(2) Once I've got the date on the Mac, I need to apply an adjustment
>factor to it.  I'm currently using:
>
>  $date_adjust	= ((1970 - 1904) * ONE_YEAR) + (16 * ONE_DAY) + (19 *
>ONE_HOUR);
>
>The first part doesn't surprise me, given the differences in epoch dates
>on Mac vs. Unix systems.  But why the 16 days 19 hours?  This gives me
>reliable dates, but it's one of the ugliest adjustments I've ever seen.
>
>If someone out there can shed some light on this I'd appreciate it.

Just from looking at those numbers, I can take a stab at it.

The 19 hours is (24 - 5) hours.  It converts from GMT, used by Unix
to local time in the Eastern timezone (which is where bu is located
as long as that is Boston University and not some other institution
with the same initials).

The 17 days (the 16 you noted, plus one more to subtract 5 from for the
timezone) is the number of leap years between 1904 and 1970.  I suppose
that the ONE_YEAR value used gives the length of non leap years.

John Macdonald             jmacd@interlog.com



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch