Ludmila,
Bit 51 in the TOD clock is the microsecond bit. Everything to the right
of that is something less than a microsecond. If you have 64 bit register
capability, just load one register with a TOD value, then another with the
other TOD, and subtract to get the difference. You can then shift out
everything beyond bit 51, and you have the number of microseconds. Leave it
without the shift, and call STCKCONV, and it will give you the time value
formatted in what you have specified on the call.
--Dave Day
----- Original Message -----
From: "Ludmila Koganer" <[EMAIL PROTECTED]>
Newsgroups: bit.listserv.ibm-main
To: <IBM-MAIN@BAMA.UA.EDU>
Sent: Monday, September 03, 2007 6:38 PM
Subject: Subtracting TOD-CLOCK values to get duration.
Hi,
I need to subtract two TOD times to find elapsed time. Currently I
convert
the two TOD times with STCKCONV and determine the elaped time
individually,
and then compute the difference. This works. However I thought I could
optimize the conversion, a little bit and I was wondering why not subtract
the
two TOD times to begin with.
As I understand TOD time is the number of mic seconds elapsed since
midnight
of 1900-01-01. So when I subtract one TOD value from another the duration
must be in micro seconds.
For example, TOD1 is X'C0E608EF7409002E' ===>2007196, 16.59.58,745744
TOD2 is X'C1E608EF7409002E' ====> 2008035,
7.43.04.790160
If I subtract the two TOD values, it is binary as in
(x'0100000000000000'). If I
convert to a packed decimal value, I get a decimal value of
72057594037927936. (sign bit not shown here)
Now I can't seem to figure the actual elapsed time based on the derived
micro
seconds. If I just treat the above value as a mic seconds then I end up
with
2284.93 years which is gloriously incorrect while the actual elapsed days
are
204 days ignoring the time part.
I am sure I am missing something here. Can someone please help.
Regards,
Ludmil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html