Knowledge Search


×
 

POSIX-compliant time-zone string

  [KB9892] Show Article Properties


Summary:
How to configure and interpret POSIX-compliant time-zone string, as mentioned in PSN-2006-12-027
Solution:
In the below example, the following daylight saving rules are assumed for West Australian Standard Time:

The first Sunday in October at 2:00am clocks go forward 1 hour.
The first Sunday in April at 3:00am clocks go back 1 hour.


According to the above requirements, in JUNOS 7.5R1 or higher the node can be configured under the [system time-zone] hierarchy as follows:

    [edit]
   georg@ankara-re0# set system time-zone WST-8WDT-9,M10.1.0/2,M4.1.0/3



Explanation of the above time-zone string:
WST zone name (West Australian Standard Time)
-8 WST is 8 hours ahead of UTC (Coordinated Universal Time)
WDT daylight savings zone name (West Australian Daylight Time)
-9 WDT is 9 hours ahead of UTC
M10.1.0/2 Start of WDT - October (Month 10), the first (1) Sunday(0), 2.00am
M4.1.0/3 End of WDT and begining of WST - April (Month 4), first (1) Sunday (0), 3.00am



Caveat:
In older releases, the above only works if the logged in user is root, or if the CLI is being reset.

See below example:

georg@ankara-re0> show system uptime | match current
Current time: 2007-06-28 14:09:05 CEST

georg@ankara-re0> configure
Entering configuration mode

[edit]
georg@ankara-re0# set system time-zone WST-8WDT-9,M10.1.0/2,M4.1.0/3

[edit]
georg@ankara-re0# commit and-quit
commit complete
Exiting configuration mode

georg@ankara-re0> show system uptime | match current
Current time: 2007-06-28 14:09:19 CEST

georg@ankara-re0> start shell user root
Password:
root@ankara-re0% cli
georg@ankara-re0> show system uptime |match current
Current time: 2007-06-28 20:09:55 WST

georg@ankara-re0>



In older releases, this only works for the current process because the POSIX modifications only works when it is set in the TZ variable. The /etc/localtime is never checked for POSIX specification format.

The problem is being tracked via PR/103724.
Related Links: