How do I set up Solaris for my time zone and daylight saving rules?

How do I set up Solaris for my time zone and daylight saving rules?



You don't need to adjust your clock. Internally, Solaris uses
Universal Time and is unaffected by time zone and daylight saving.
However, you may need to adjust the TZ line in /etc/default/init to
match your location, so that programs can read and display time stamps
appropriately for your location. For example, you should use the line:



TZ=Australia/Broken_Hill


if you are in Broken Hill, Australia. After you change the TZ line in
/etc/default/init, reboot to propagate the change to all processes.


A TZ setting like Australia/Broken_Hill operates by referring to a
file /usr/share/lib/zoneinfo/Australia/Broken_Hill that contains
compiled data about the history of time zone and daylight saving
changes at that location. You can run the time zone compiler
yourself with a command like the following:



# In Solaris 8 and later: cd /usr/share/lib/zoneinfo/src
cd /usr/share/lib/zoneinfo
/usr/sbin/zic africa asia australasia europe northamerica southamerica


This command generates compiled time zone files for all the locations
mentioned in the text files 'africa', 'asia', etc. This is a much
larger set than the set of compiled time zone files shipped by default
in Solaris. If you're in an unusual location, you'll need to run zic
to get the proper time zone file; e.g. you must run zic to get
TZ=Antarctica/South_Pole to work.


Time zones and daylight saving rules change every now and then, so the
files in /usr/share/lib/zoneinfo are periodically updated by Sun, and
you may need to install a time zone patch (e.g. patch 103834 for
Solaris 2.5.1) to bring things up to date for your location. Or you
can install the most recent version of the time zone text files from
the public domain time zone database <ftp://elsie.nci.nih.gov/pub/>,
and compile the files yourself with zic.


You can also use a POSIX TZ setting like
TZ=CET-1CEST,M3.5.0/2,M10.5.0/3 as described in the environ(5) man
page, but this is more confusing and is easy to get wrong, and it
mishandles time stamps preceding the most recent time zone or
daylight saving rule change.





Home
FAQ