TZ
¶In POSIX systems, a user can specify the time zone by means of the
TZ
environment variable. For information about how to set
environment variables, see Environment Variables. The functions
for accessing the time zone are declared in time.h.
You should not normally need to set TZ
. If the system is
configured properly, the default time zone will be correct. You might
set TZ
if you are using a computer over a network from a
different time zone, and would like times reported to you in the time
zone local to you, rather than what is local to the computer.
The value of TZ
can be in one of the following formats:
TZ
.
Here are some examples:
Asia/Tokyo America/New_York /usr/share/zoneinfo/America/Nuuk
TZ
.
Here are some examples:
JST-9 EST+5EDT,M3.2.0/2,M11.1.0/2 <-02>+2<-01>,M3.5.0/-1,M10.5.0/0
:/etc/localtime
Each operating system can interpret this format differently; in the GNU C Library, the ‘:’ is ignored and characters are treated as if they specified the geographical or proleptic format.
TZ
is the empty string,
the GNU C Library uses UTC.
If the TZ
environment variable does not have a value, the
implementation chooses a time zone by default. In the GNU C Library, the
default time zone is like the specification ‘TZ=/etc/localtime’
(or ‘TZ=/usr/local/etc/localtime’, depending on how the GNU C Library
was configured; see Installing the GNU C Library). Other C libraries use their own
rule for choosing the default time zone, so there is little we can say
about them.