Thanks all for the research :-)
__________________________________________
Ranga Nathan / CSG
Systems Programmer - Specialist; Technical Services; 
BAX Global Inc. Irvine-California
Tel: 714-442-7591   Fax: 714-442-2840





Bob Rogers <[EMAIL PROTECTED]>

Sent by: [EMAIL PROTECTED]
07/28/2004 07:17 PM
 
        To:     John Abreau <[EMAIL PROTECTED]>, Ranga Nathan 
<[EMAIL PROTECTED]>
        cc:     [EMAIL PROTECTED]
        Subject:        Re: [Boston.pm] Need time since 1900-01-01 
00:00:00


   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

If I can find out what is the number of seconds since 1900-01-01 00:00 to 
1969-12-31 23:59 then I can add that number to time() to get secnods since 
1900-01-01 00:00:00. Is this 2208988800 that number?

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

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

Reply via email to