The API USR1023N in library SYSEXT is used for time conversions. The text member USR1023T contains the description. It gives you also an overview of the copycodes.
There are also copycodes delivered. You can take a look into the copycodes to see how time conversion works.
USR1023Y - Convert a store clock value into microseconds.
/* Transferred Parameters
/* ----------------------
/* &1& Input: store clock value, format (B8), such as TIMESTMP
/ &2& Output: microseconds since 1900-01-01 00:00:00,
/* format (P19), (N19) or (F8)
USR1023X - Convert microseconds into Natural time.
/* Transferred Parameters
/* ----------------------
/* &1& Input: microseconds since 1900-01-01 00:00:00,
/* format (P19), (N19) or (F8)
/* &2& Output: Packed field (P12), redefinition of Natural time
/* value (T)
The conversion is straight forward. The conversion from Natural format into human readable format is done in Natural inside.
Some more information regarding the Store clock and Natural time:
/* Store Clock Value:
/* The Natural system variable TIMESTMP provides the machine-internal
/ store clock value as (B8) binary value.
/* The layout of the store clock value is described in
/* IBM z/Architecture Principles of Operation
/* > Chapter 4. Control > Timing
/*
/* Summary of store clock value:
/* - The clock controls a 64 bit register.
/* - Leftmost bit is at position 0; it is the MSB (most signif. bit).
/* - Bit position 31 is incremented every 1.048576 seconds.
/* - Bit position 51 represents exactly one microsecond.
/* - Bit position 59 (if implemented), represents 3,90625 nano
/* seconds.
/* - Bit position 63 (if implemented), is approximately 244 pico
/* seconds.
/* - On MF bit position 60-63 contains the processor ID
/* (max. 16 processors)
/* - On Windows and UNIX the accuracy is at least microseconds.
/* For uniqueness, if two timestamps are within a one time unit,
/* an offset will be added by Natural.
/* - One day adds 0001 41DD 7600 0000 to the clock.
/* - The clock starts on:
/* 1900-01-01 00:00:00.000000 (GMT)
/* with store clock = 0000 0000 0000 0000
/* - The clock ends at 2042-09-17 23:53:47.370495 (GMT)
/* with store clock = FFFF FFFF FFFF F000
/* - Clock settings at start of year:
/* 1976 … 8853 BAF0 B400 0000
/* 1984 … 96AD 84B5 9000 0000
/* 1992 … A507 4E7A 6C00 0000
/* 2000 … B361 183F 4800 0000
/* 2042 … FEB9 1C77 8600 0000
/* - The store clock range corresponds to the following range
/* of microseconds (since 1900-01-01 00:00:00.000000):
/* 0 <= microseconds <= 4503599627370495
/*
/* Natural Time Value
/* The Natural system variable TIMX provides the time of day
/ in internal Natural time format (T) represented by a 12 byte packed
/* field (P12).
/*
/* Summary of Natural time value:
/* - The packed value is incremented every 1/10 second.
/* - The Natural time starts on:
/* 0000-01-02 00:00:00.0
/* with packed value = 0
/* - The Natural time ends at 3168-11-16 09:46:39.9
/* with packed value = 999999999999
/* - The Natural time range corresponds to the following range
/* of microseconds (since 1900-01-01 00:00:00.000000):
/* -59958144000099999 <= microseconds <= 40041855999999999