BS2000 extends the TODR by TODR epochs. This enables a system time to be displayed up to 4317-03-18 02:44:48.587775.
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 parameter (also referred to as “Epoch Designator”) 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]. GTIME (and also the SHOW-SYSTEM-INFORMATION command) supply the current EPOCH value as feedback. Programs which themselves calculate using the TODR can use the algorithm described in the section "Calculating with TODR epochs".
The EPOCH parameter consists of two hexadecimal digits, <epc><epo>:
The first hexadecimal digit (<epc>, “Epoch Counter”) specifies one of the disjunct main epochs from TODR in ascending order
The second hexadecimal digit (<epo>, “Epoch Offset”) specifies, in ascending order, a TODR epoch which begins in the main epoch determined by <epc> and extends into the next main epoch, in other words overlaps the main epochs
EPOCH=00 specifies the standard epoch, i.e. the period from 1900-01-01 00:00:00 to 2042-09-17 23:53:47.370495
Figure 30: TODR epochs
This permits a smooth transition between the epochs for the system (see also the example below).
Example
The standard epoch (up to 2042-09-17 23:53:47.370495), i.e. EPOCH=00, has applied to date.
The current date is now 2030-01-02, and systems support considers it necessary to prepare the system for the expiry of the standard epoch on 2042-09-17.
This could be done, for example, using the setting EPOCH=08. The period from 1971-05-11 11:56:53.685248 to 2114-01-26 11:50:41.055743 is then set for the TODR, see the table below. Time stamps earlier than 1971-05-11 11:56:53.685248 can then no longer be compared without recalculating using the current TODR.
Theoretically the values EPOCH=01 through EPOCH=0E could be used for the changeover on 2030-01-02. However, lower EPOCH values specify an epoch which exceeds the previous epoch by just a few years. When high epoch values are used, there is a danger that time stamps which are only a few years in the past can no longer be compared directly with the current TODR.
Tables for the TODR epochs
EPOCH= | Date and time | Date and time | Value of the TODR | Value of the TODR To |
00 | 1900-01-01 | 2042-09-17 | 00000000 00000000 | FFFFFFFF FFFFF000 |
01 | 1908-12-02 | 2051-08-19 | 10000000 00000000 | 0FFFFFFF FFFFF000 |
02 | 1917-11-03 | 2060-07-20 | 20000000 00000000 | 1FFFFFFF FFFFF000 |
03 | 1926-10-05 | 2069-06-12 | 30000000 00000000 | 2FFFFFFF FFFFF000 |
04 | 1935-09-06 | 2078-05-23 | 40000000 00000000 | 3FFFFFFF FFFFF000 |
05 | 1944-08-07 | 2087-04-24 | 50000000 00000000 | 4FFFFFFF FFFFF000 |
06 | 1953-07-08 | 2096-03-24 | 60000000 00000000 | 5FFFFFFF FFFFF000 |
07 | 1962-06-09 | 2105-02-24 | 70000000 00000000 | 6FFFFFFF FFFFF000 |
08 | 1971-05-11 | 2114-01-26 | 80000000 00000000 | 7FFFFFFF FFFFF000 |
09 | 1980-04-11 | 2122-12-28 | 90000000 00000000 | 8FFFFFFF FFFFF000 |
0A | 1989-03-13 | 2131-11-29 | A0000000 00000000 | 9FFFFFFF FFFFF000 |
0B | 1998-02-11 | 2140-10-29 | B0000000 00000000 | AFFFFFFF FFFFF000 |
0C | 2007-01-13 | 2149-09-30 | C0000000 00000000 | BFFFFFFF FFFFF000 |
0D | 2015-12-15 | 2158-09-01 | D0000000 00000000 | CFFFFFFF FFFFF000 |
0E | 2024-11-15 | 2167-08-03 | E0000000 00000000 | DFFFFFFF FFFFF000 |
0F | 2033-10-17 | 2176-07-04 | F0000000 00000000 | EFFFFFFF FFFFF000 |
Table 49: All TODR epochs with <epc> = 0
EPOCH= | Date and time | Date and time | Value of the TODR | Value of the TODR To |
00 | 1900-01-01 | 2042-09-17 | 000000 00000000 | FFFFFF FFFFF000 |
10 | 2042-09-17 | 2185-06-04 | 000000 00000000 | FFFFFF FFFFF000 |
20 | 2185-06-04 | 2328-02-21 | 000000 00000000 | FFFFFF FFFFF000 |
... | ||||
F0 | 4040-09-12 | 4183-05-31 | 000000 00000000 | FFFFFF FFFFF000 |
Table 50: TODR main epochs (<epc> = 0, 1, 2, etc.)
TODR format TODX
In BS2000 the format TODX is provided for the TODR. TODX consists of a double word and contains the number of microseconds before the start of the standard epoch (1900-01-01, 00:00:00).
The TODX format is used/supplied in the user macros CTIME (Time stamp calculations) and GTIME (Get date and time), see the “Executive Macros” manual [30]. It is also used for epoch-independent display of a time stamp and for calculating with time stamps from different epochs.
In the standard epoch TODX corresponds to a TODR whose content has been moved 12 bits to the rights. However, in contrast to the TODR (upper limit 2042-09-17 23:53:47.370495), the upper limit of TODX extends far into the future (upper limit 4317-03-18 02:44:48.587775). This upper limit is the result of the internal connection with the TODR format extended by EPD.
Calculating with TODR epochs
The algorithm below uses a specified TODR and the associated value of the EPD to calculate the number of microseconds since the start of the standard epoch (1900-01-01, 00:00), i.e. the TODX format.
:* todx: Number of microseconds since 1900-01-01 00:00:00.000000 :* todr: Value of the TODR, supplied by GTIME or CTIME :* epd : Value of the EPD, supplied by GTIME :* epc : Epoch Counter (first hexadecimal digit of the EPD) :* epo : Epoch Offset (second hexadecimal digit of the EPD) epc:=epd >> 4; :* epc is formed from epd, moved 4 bits to the right epo:=epd & x'0F'; :* epo is formed from epd, 4 bits on left deleted todx:=todr >> (3*4); :* todx is initialized from specified todr, moved 12 bits :* to the right if((todx >> 12*4) LT epo) epc:=epc+1; :* when the initialized todx (moved another 48 bits to the right) :* is less than epo, the time is in the next main epoch; :* epc must therefore be incremented by one. todx:=todx + epc * x'00100000 00000000'; :* correction of the initialized todx by the value of epc
The highest possible value for TODX when epd=x'FF'
and todr=x'EFFFFFFF FFFFF000'
is todx=x'010EFFFF FFFFFFFF'
.
The following also applies for a specified epoch EPD:
Start of epoch:
TODX = EPC << (13*4) + EPO << (12*4)
(inclusive)End of epoch:
TODX = (EPC+1) << (13*4) + EPO << (12*4)
(exclusive)
Comment
A todr
time stamp of the standard epoch as may possibly still exist in “old” data sets is easily converted to TODX format using the algorithm above and can then be compared with a TODX value from any epoch. Since in this case epd=0
, the algorithm is reduced to: todx:=todr >> (3*4).