Subject: | |
From: | |
Reply To: | |
Date: | Fri, 11 Feb 2005 11:43:48 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
> When you pass this field to the intrinsic "HPDATECONVERT" it will convert
> the longint-type to a real date such as 20050207 for Feb 7, 2005. Fine. I am
Uh, you mean "human readable" date? :) the microseconds since 1970
is just as "real" a date as a string of 8 digits!
> So, can anyone out there tell me how to convert a real date AND time
> sequence (e.g. 20050307 12:34:56) to "microseconds since January 1, 1970"
> for the impending AIF call to update the timestamps in a file?
The basic answer is: +
I'll expand on that...
Summary of problem:
You're trying to convert a yyyymmdd hh:mm:ss date/time into
microseconds-since-1970, and you've just discovered an omission
in the date/time formats that HPDATECONVERT supports.
Background:
Oops, my fault ... I should have thought of that when I proposed
that intrinsic! In retrospect, there should have been at least
one more format supported by the intrinsic, an 8 byte structure
with a 4 byte CALENDAR value followed by a 4 byte CLOCK value.
Solution:
1) If COBOL can't do 64-bit integer arithmetic:
a) convert the yyyymmdd to type 10 (int32, seconds since 1970)
b) add to that:
hh * 3600 + mm * 60 + ss
c) HPDATECONVERT the sum (which is type 10 date/time) to type 1
(int64, microsecs since 1970)
2) if COBOL can do 64-bit integer arithmetic:
a) convert the yyyymmdd to type 10 (int32, seconds since 1970)
b) add to that:
hh * 3600 + mm * 60 + ss
c) multiply by one million
Stan
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|