Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Local time in POSIX

&pagelevel(3)&pagelevel

The information on the local time supplied by POSIX interfaces can, under certain circumstances, differ from the information supplied by the corresponding BS2000 interfaces. This does not, however, affect the information on the Coordinated Universal Time (UTC).

The reason for this difference is that BS2000 interfaces and POSIX interfaces use separate mechanisms for "localizing" the time.


In BS2000 the settings which are defined in the PARAMS.GTIME file at system startup apply for the local time.

Example:

/BS2000 PARAMS
/BEGIN GTIME
ZONE=+01:00
DIFF=1:00
SEASON=S
CHDATE=1900-01-01/00:00
CHDATE=1980-04-06/02:00
CHDATE=1980-09-28/03:00
...
CHDATE=2020-03-29/02:00
CHDATE=2020-10-25/03:00
CHDATE=2021-03-28/02:00
CHDATE=2021-10-31/03:00
CHDATE=2022-03-27/02:00
CHDATE=2022-10-30/03:00
CHDATE=2023-03-26/02:00
CHDATE=2023-10-29/03:00
CHDATE=2024-03-31/02:00
CHDATE=2024-10-27/03:00
NEXTZONE
...
/EOF
/END-PARAMS


In POSIX the settings which are defined in the environmental variable TZ when the corresponding CRTE interfaces are called apply for the local time.

Example (default setting = Central Europe):

$ echo $TZ
MEZ-1MSZ-2,M3.5.0/02:00:00,M10.5.0/03:00:00
$ 

The content of the TZ variable in this example must be interpreted as follows:

MEZ-1  Default time zone

NameMEZ
DifferenceMEZ - 01:00:00 = UTC

MSZ-2  Alternative time zone

NameMSZ
DifferenceMSZ - 02:00:00 = UTC

M3.5.0/02:00:00  Time for switching to the alternative time zone

Month3 = March
Week5 (or 4 if the month does not have 5 weeks)
Weekday0 = Sunday
Time02:00:00

M10.5.0/03:00:00  Time for switching back to the default time zone

Month10 = October
Week5 (or 4 if the month does not have 5 weeks)
Weekday0 = Sunday
Time03:00:00

Supplying values for the TZ variable in POSIX

When POSIX-BC is installed, the /etc/TIMEZONE file is intalled with the following content:

TZ=MEZ-1MSZ-2,M3.5.0/02:00:00,M10.5.0/03:00:00

A shell script is concerned here which sets the TZ variable in the calling shell if it is called using a dot command ( . /etc/TIMEZONE ). The TZ variable is automatically exported, i.e. it is automatically propagated to child processes.

The /etc/TIMEZONE script is executed with every type of POSIX login, in other words also when opening a dialog or batch session with /START-POSIX-SHELL, and in the case of rlogin, telnet, rsh and ssh. It is also executed by the RC scripts before daemons are started.

The TZ variable is thus supplied with a value in all daemons and login scripts and also in all processes these generate with fork(). It thus controls the CRTE functions for determining the local time.

The /etc/TIMEZONE file is also reinstalled in the event of an upgrade installation of POSIX-BC. As a result, any changes the administrator may have made are overwritten.

Restrictions for the POSIX mechanism with the TZ variable

The POSIX mechanism permits only one fixed rule for changeover points between the default and alternative time zones and no variations from year to year. This complies with the currently applicable EU regulations.

Consequently timestamps which are earlier than 1996, i.e. which were specified before a fixed rule was introduced for changeover times, can under certain circumstances be incorrectly “localized”.