You wanted assembler. Can you read C as though it were pseudo-code? This gets 
you partway there. (C library strftime() gets you the rest of the way if that 
is an option.) Assume stckValue is the TOD clock value.

        psaptr = NULL;
        cvtptr = static_cast<cvt *>(psaptr->flccvt);
        cvtxtnt2 *cvt2ptr;
        cvt2ptr = *reinterpret_cast<cvtxtnt2 **>(&cvtptr->cvtext2);  
        stckValue -= *reinterpret_cast<long long *>(&cvt2ptr->cvtlso);       // 
leap seconds since 1970 (as TOD clock value)

        // shift stckValue right 12 bits to get microseconds
        stckValue >>= 12;

        // divide by one million. quotient is seconds, remainder is microseconds
        fractionalSeconds = stckValue % oneMillion;
        stckValue = stckValue / oneMillion;

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Donald Russell
Sent: Tuesday, September 30, 2014 3:41 PM
To: [email protected]
Subject: Convert TOD to calendar date/time

I have zOS 2.1 and am looking for an assembler macro or some other utility I 
can call (load/delete or via cvt etc) to convert an 8-byte TOD clock value into 
a character string like yyyy-mm-dd hh:mm:ss.uuuuuu

That actual date format doesn't matter too much, I'm more interested in the 
time portion and sub-second precision.

Is there anything like that already available, or do I need to write my own?

Thank you,
Donald Russell


--
Sent from iPhone Gmail Mobile

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to