Changing Timezones in SunOS 4.0

Alexander Dupuy dupuy at columbia.edu
Wed Jan 11 16:06:04 AEST 1989


One of the really nice things about 4.0 is that Sun has incorporated
Arthur Olson's timezone code, which makes it possible to change the
system's notion of the local timezone without even rebooting!  To change
the local timezone, just rm /usr/lib/zoneinfo and link it to the
appropriate file, e.g.:

amsterdam# date
Tue Jan  3 17:54:40 EST 1989
amsterdam# rm /usr/lib/zoneinfo/localtime
amsterdam# ln /usr/lib/zoneinfo/Navajo /usr/lib/zoneinfo/localtime
amsterdam# date
Tue Jan  3 15:55:53 MST 1989
amsterdam# rm /usr/lib/zoneinfo/localtime
amsterdam# ln /usr/lib/zoneinfo/US/Eastern /usr/lib/zoneinfo/localtime
amsterdam# date
Tue Jan  3 17:56:27 EST 1989

Of course, the various daemons may be running in the old timezone, so you
might want to go to single-user (via shutdown) and then back to multi-user
after doing this.

Actually, now that I've looked at the manual page, I see I could have used
the commands "/usr/etc/zic -l Navajo" and "zic -l US/Eastern" to do the
same thing more easily (and portably).

You can even create new timezones using zic.  You can look at the file
/usr/share/lib/zoninfo/australasia and modify it as needed, then run zic
on it.

This stuff is really neat if you're into obscure time-related trivia, like
me.  The only things which the Sun stuff doesn't handle are solar time
(they compiled the code with NOSOLAR defined, argh) and leap seconds, for
which support was added in a later version of Olson's code (now in
4.3-tahoe).

@alex



More information about the Comp.sys.sun mailing list