From: John Abreau <[EMAIL PROTECTED]>
   Date: 28 Jul 2004 21:21:03 -0400

   On Wed, 2004-07-28 at 20:58, Ranga Nathan wrote:

   > Is there a quick way to convert a time stamp (date & time)  as seconds 
   > since 1900-01-01 00:00:00?
   > time() uses 1970 as base (epoch).
   > But the system I am dealing with on mainframe uses 1900 as base.
   > 
   > Looked at Date::Calc and Date::Manip but they  dont seem to handle this.
   > 
   > Rather than hand-roll some calculations.....huh, I am lazy. That's why I 
   > Perl!
   > 
   > Thanks for any help!

   Well, a google search for "seconds in a year" drops into some sort of 
   google calculator that says there are 31,556,926 seconds in a year. 
   Multiply that by 70 years, and you get an approximate difference 
   of 2,208,984,820. Add that constant to a Unix date value, and you'll 
   have your corresponding mainframe date value.  

A quick perusal of the guts of CMU Common Lisp yields the following
useful value:

    COMMON-LISP::UNIX-TO-UNIVERSAL-TIME [constant] value: 2208988800

Common Lisp uses 1900-01-01 00:00:00 as its epoch, so the mainframe
should also buy this value.

   The difference between that and Google's number is due to the fact
that 2208984820 is the number of seconds in an "average" year, which is
not a whole number of days -- it's more like 365.24 days.  In fact,
2208988800 seconds divided by 86400 seconds per day is exactly 25567
days, which is 70*365+17; there are only 17 leap years in 1900-1969 as
1900 was not a leap year.  QED.

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to