Re: [Boston.pm] Need time since 1900-01-01 00:00:00

2004-07-29 Thread John Abreau
On Wed, 2004-07-28 at 22:17, Bob Rogers wrote:

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.

Yeah, I checked the leap seconds, but somehow I forgot to add in the 
leap days. Must have been one of those caffeine-deficiency brain farts. 

-- 
John Abreau / Executive Director, Boston Linux  Unix
Email [EMAIL PROTECTED] / WWW http://www.abreau.net / PGP-Key-ID 0xD5C7B5D9
PGP-Key-Fingerprint 72 FB 39 4F 3C 3B D6 5B E0 C8 5A 6E F1 2C BE 99



signature.asc
Description: This is a digitally signed message part
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


[Boston.pm] Need time since 1900-01-01 00:00:00

2004-07-28 Thread Ranga Nathan
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!

__
Ranga Nathan / CSG
Systems Programmer - Specialist; Technical Services; 
BAX Global Inc. Irvine-California
Tel: 714-442-7591   Fax: 714-442-2840
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Need time since 1900-01-01 00:00:00

2004-07-28 Thread John Abreau
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.  

I was going to point out that this doesn't account for leap seconds, 
but after checking google again, I found that the first leap second 
was added to the calendar on June 30, 1972, which means it's not 
relevant to this particular computation. 

-- 
John Abreau / Executive Director, Boston Linux  Unix
Email [EMAIL PROTECTED] / WWW http://www.abreau.net / PGP-Key-ID 0xD5C7B5D9
PGP-Key-Fingerprint 72 FB 39 4F 3C 3B D6 5B E0 C8 5A 6E F1 2C BE 99



signature.asc
Description: This is a digitally signed message part
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Need time since 1900-01-01 00:00:00

2004-07-28 Thread Ron Newman
On Jul 28, 2004, at 8:58 PM, 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).
time() + (24*60*60)*((365*70)+int(70/4))
24*60*60 is the number of seconds in a day
365*70 is the number of days in 70 ordinary (non-leap) years
int(70/4) is the number of leap days to add.  (note that 1900 is not a 
leap year)

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


Re: [Boston.pm] Need time since 1900-01-01 00:00:00

2004-07-28 Thread Bob Rogers
   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


Re: [Boston.pm] Need time since 1900-01-01 00:00:00

2004-07-28 Thread Ranga Nathan
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