Mailinglist Archive: opensuse (1445 mails)

< Previous Next >
Re: [opensuse] Wrong time zone

On Sat, 24 Mar 2012, Carlos E. R. wrote:
Find out if you have a TZ variable defined.

What I don't remember is where is the default stored.

/etc/localtime is a copy of or a symlink to the timezone-file under
/usr/share/zoneinfo. /etc/init.d/boot.clock actually unsets TZ, so by
default TZ is not set and /etc/localtime used.

==== man 3 tzset ====
If the TZ variable does not appear in the environment, the tzname vari-
able is initialized with the best approximation of local wall clock
time, as specified by the tzfile(5)-format file localtime found in the
system timezone directory (see below). (One also often sees
/etc/localtime used here, a symlink to the right file in the system
timezone directory.)

$ oTZ="$TZ"; unset TZ; strace -eopen date 2>&1 | grep -v lib; TZ="$oTZ"
open("/etc/", O_RDONLY) = 3
open("/etc/localtime", O_RDONLY) = 3
Mon Mar 26 05:25:15 CEST 2012
$ strace -eopen date 2>&1 | grep -v lib
open("/etc/", O_RDONLY) = 3
open("/usr/share/zoneinfo/right/Europe/Berlin", O_RDONLY) = 3
Mon Mar 26 05:25:37 CEST 2012
$ TZ=UTC strace -eopen date 2>&1 | grep -v lib
open("/etc/", O_RDONLY) = 3
open("/usr/share/zoneinfo/UTC", O_RDONLY) = 3
Mon Mar 26 03:26:27 UTC 2012

FWIW, I set TZ in /etc/profile.local.


O'Neill: [on Freyr] This little feller is about three feet tall, got
clammy grey skin, big black eyes, and skinny, tiny little arms and
legs like toothpicks. -- Stargate SG-1, 5x05 - Red Sky
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups