BS2000 extends the TODR by a TODR epoch. This enables a system time to be displayed different from the past default range (from 1900-01-01 00:00:00.000000 to 2042-09-17 23:53:47.370495) which corresponds to the default epoch 00.
The TODR epoch for the current session is set in the startup parameter service, GTIME parameter record, EPOCH parameter, see the section "System time control (GTIME)". It cannot be changed during the session.
The epoch designation is automatically taken into account in the user macros CTIME (Time stamp calculations) and GTIME (Get date and time), see the “Executive Macros” manual [30]. The value of the current epoch designation can be obtained via the user macro GTIME and also the SHOW-SYSTEM-INFORMATION command.
To ensure that the functions GTIME and CTIME correctly interpret the TODR, even after its overflow in the year 2042, the default epoch will be changed from 00 to 08 well in advance. This will allow the representation of a date range from 1971 to 2114 (see table below).
For applications which use timestamps in TODR format, this may lead to incompatibilities and they must be adapted before changing the epoch. Therefore it is strongly recommended that applications do not store timestamps in TODR format to allow trouble-free changes of the TODR epoch.
Interpretation of TODR Time Stamps with TODR Epochs 00 and 08
TODR Time Stamp (hex) | Date and Time Interpretation | |
---|---|---|
EPOCH=00 | EPOCH=08 | |
00000000 00000000 | 1900-01-01 00:00:00.000000 | 2042-09-17 23:53:47.370496 |
7FFFFFFF FFFFF000 | 1971-05-11 11:56:53.685247 | 2114-01-26 11:50:41.055743 |
80000000 00000000 | 1971-05-11 11:56:53.685248 | 1971-05-11 11:56:53.685248 |
FFFFFFFF FFFFF000 | 2042-09-17 23:53:47.370495 | 2042-09-17 23:53:47.370495 |
TODX Time Stamp Format
As an alternative to the TODR format, the TODX time stamp format is also available in BS2000. TODX consists of a double word and contains the number of microseconds since 1900-01-01 00:00:00.000000. In contrast to the TODR format, the TODX format covers a much wider time span (from the year 1900 to the year 4317).
The TODX format is used/supplied by the user macros CTIME (Time stamp calculations) and GTIME (Get date and time), see the “Executive Macros” manual [30]. It is useful for epoch-independent representation of a time stamp and for calculating with time stamps from different epochs.
With the current default epoch 00, a TODX time stamp corresponded to a TODR time stamp whose content has been moved 12 bits to the right.
Programs which themselves calculate using TODR values can use the algorithms described in the section "Converting TODR time stamps to TODX time stamps".
Converting TODR time stamps to TODX time stamps
The algorithms below use a TODR value and the associated value of the epoch designation to calculate the number of microseconds since 1900-01-01 00:00:00.000000, i.e. the TODX value.
The variables and operators used are:
TODX : TODX value, i.e. number of microseconds since 1900-01-01 00:00:00.000000 TODR : TODR value EPD : value of the epoch designation (1 byte) EPC : epoch counter (first hexadecimal digit of EPD) EPO : epoch offset (second hexadecimal digit of EPD) x >> n : Right-shift value x by n bits y & y : AND operation (bit by bit)
Algorithm for the current default epoch designation 00:
TODX := TODR >> 12;
Algorithm for the future default epoch designation 08:
TODX := TODR >> 12; if ((TODX >> 48) < 8) TODX := TODX + x'0010000000000000';
Common algorithm for any epoch designation:
TODX := TODR >> 12; EPC := EPD >> 4; EPO := EPD & x'0F'; if ((TODX >> 48) < EPO) EPC := EPC + 1; TODX := TODX + EPC * x'0010000000000000';
Ranges of other TODR Epochs
EPOCH | Date and Time | |
from | to | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|