Longpela Expertise logo
Longpela Expertise Consulting
Longpela Expertise
Home | Press Room | Contact Us | Site Map

Tools: TOD Clock Converter


Convert Time of Day (TOD) Clock values from the STCK and STCKE instructions to date/time and UNIX date/time values.

Convert From STCK


Notes About TOD Clock Values

Excel Formulas for TOD Clock Values

Use these formulas to convert a STCK TOD clock value (not STCKE) to a date and time in Excel. Formula assume TOD clock value is in cell B1:

  • Date: =(((HEX2DEC(LEFT(B1,8))*4294967296)+(HEX2DEC(RIGHT(B1,8))))/4096000000/86400)+2
  • Time: =(((HEX2DEC(LEFT(B1,8))*4294967296)+(HEX2DEC(RIGHT(B1,8))))/4096000000/86400)
(Thanks to Simon Foley)

Other Notes

System z mainframes store the Time of Day (TOD) Clock as a 104 bit register holding a value that represents the time elapsed since 00:00:00 on Jan 1, 1900. Bit 51 of this register is incremented every microsecond.

You can get this information using one of two instructions:

1. STCK (Store Clock) - this is the older style instruction. You get a doubleword which is the first 64 bits of the TOD clock value.

2. STCKE (STCK Extended) - You get four words that look like::

So you get the whole TOD clock, an extra byte of zeroes at the beginning, and a programmable section used by z/OS at the end.

The problem with a 104 bit TOD clock is that it will run out of bits at the end of 17-Sep-2042, and the time will reset to 01-Jan-1900. To solve this, later Mainframe models will use a larger TOD clock register and the high order byte from the STCKE instruction will be used.

To get a correct UTC value, you need to add 'leap seconds' to the TOD clock value. This number of leap seconds for the current time is stored in the CVT field CVTLSO.

Of course this assumes that the TOD Clock is set to UTC time, and an offset to local time is specified in the CLOCKxx parmlib member.

An interesting fact: STCK will ALWAYS produce a unique number throughout a CPC. The STCKE instruction will ALWAYS produce a unique number throughout a sysplex.



Use this tool to convert TOD Clock Values to Readable and UNIX Date/Time values

Enter an 8 byte STCK value or 16 byte STCKE value. This number will be padded to the right with zeroes.


  • This tool can only convert TOD values after Jan 1, 1970.
  • Leap seconds are NOT added by this tool.
  • If the value entered is no more than 8 bytes long, an STCK value is assumed
  • If the value entered is more than 8 bytes long, an STCKE value is assumed
  • Find out more about the Series z TOD Clock in the Principles of Operation manual.

Longpela Expertise understand what's 'under the hood' of z/OS and related systems like CICS and IMS.
We can read dumps, diagnose complex problems, and write and maintain assembler routines.
Contact us to get your own z/OS internals expert.

© Copyright 2010 Longpela Expertise  |  ABN 55 072 652 147
Legal Disclaimer | Privacy Policy Australia
Website Design: Hecate Jay