GMT vs. Local Time -- Some help please!

GMT vs. Local Time -- Some help please!

Post by Robert C. Paulsen, Jr » Mon, 15 Feb 1999 04:00:00



Hello,

Just installed SuSE 5.3 and am having one problem: When logged in as a
regular user, my time displays as GMT instead of as local time. Logging
in as root I see the local time.

I can't figure out how to fix this. SuSE has a configuration program
(YaST) which lets me specify the time zone, but somehow this is only
taking effect for root, not for regular users.

--
Robert Paulsen                         http://paulsen.home.texas.net
If my return address contains "ZAP." please remove it. Sorry for the
inconvenience but the unsolicited email is getting out of control.

 
 
 

GMT vs. Local Time -- Some help please!

Post by Charles Sulliva » Mon, 15 Feb 1999 04:00:00


For compatibility with DOS/Win98 I keep my system clock set to local time
and
I haven't checked to see how this is handled in Linux, but the Unixes I used
always kept their internal clock set to GMT and there was an environment
variable
which defined the local timezone and its difference from GMT, something like
"TZ=EST6EDT" (for Eastern USA time zones.)   Would there be something like
this
in either the root or user profile (~/.profile or ~/.login or
~/.bash_profile) but not in both?
Compare the environment as root with that as user.

Regards,
Charles Sullivan



Quote:>Hello,

>Just installed SuSE 5.3 and am having one problem: When logged in as a
>regular user, my time displays as GMT instead of as local time. Logging
>in as root I see the local time.

>I can't figure out how to fix this. SuSE has a configuration program
>(YaST) which lets me specify the time zone, but somehow this is only
>taking effect for root, not for regular users.

>--
>Robert Paulsen                         http://paulsen.home.texas.net
>If my return address contains "ZAP." please remove it. Sorry for the
>inconvenience but the unsolicited email is getting out of control.


 
 
 

GMT vs. Local Time -- Some help please!

Post by Ross Crawfor » Mon, 15 Feb 1999 04:00:00


Robert,

Log in as root, and echo $TZ. Then put a line in /etc/profile (or whatever
your global profile script is) that sets this for all users.

Regards,

ROSCO


Quote:> Hello,

> Just installed SuSE 5.3 and am having one problem: When logged in as a
> regular user, my time displays as GMT instead of as local time. Logging
> in as root I see the local time.

> I can't figure out how to fix this. SuSE has a configuration program
> (YaST) which lets me specify the time zone, but somehow this is only
> taking effect for root, not for regular users.

> --
> Robert Paulsen                         http://paulsen.home.texas.net
> If my return address contains "ZAP." please remove it. Sorry for the
> inconvenience but the unsolicited email is getting out of control.

 
 
 

GMT vs. Local Time -- Some help please!

Post by Robert C. Paulsen, Jr » Mon, 15 Feb 1999 04:00:00



> For compatibility with DOS/Win98 I keep my system clock set to local time
> and
> I haven't checked to see how this is handled in Linux, but the Unixes I used
> always kept their internal clock set to GMT and there was an environment
> variable
> which defined the local timezone and its difference from GMT, something like
> "TZ=EST6EDT" (for Eastern USA time zones.)   Would there be something like
> this
> in either the root or user profile (~/.profile or ~/.login or
> ~/.bash_profile) but not in both?
> Compare the environment as root with that as user.

I did the compare and the only differences are that each has a different
value for the following:

HOME=
LOGNAME=
MAIL=
PATH=
PS1=
USER=

There was nothing about TZ in either.

--
Robert Paulsen                         http://paulsen.home.texas.net
If my return address contains "ZAP." please remove it. Sorry for the
inconvenience but the unsolicited email is getting out of control.

 
 
 

GMT vs. Local Time -- Some help please!

Post by Villy Kru » Mon, 15 Feb 1999 04:00:00




Quote:

>I did the compare and the only differences are that each has a different
>value for the following:

>HOME=
>LOGNAME=
>MAIL=
>PATH=
>PS1=
>USER=

>There was nothing about TZ in either.

This is actually normal on linux systems.

On a redhat system this is defined by some symbolic links like this.

   /etc/localtime -> ../usr/share/zoneinfo/Europe/Amsterdam
   /usr/share/zoneinfo/localtime -> ../../../etc/localtime
   /usr/share/zoneinfo/posixrules -> localtime
   /usr/share/zoneinfo/posixtime -> localtime

You could acheive the same using the TZ variable like this:

   TZ=Europe/Amsterdam
   export TZ

where you need to choose the right file name from the zoneinfo directory.

Villy

 
 
 

GMT vs. Local Time -- Some help please!

Post by Robert C. Paulsen, Jr » Mon, 15 Feb 1999 04:00:00



> On a redhat system this is defined by some symbolic links like this.

>    /etc/localtime -> ../usr/share/zoneinfo/Europe/Amsterdam
>    /usr/share/zoneinfo/localtime -> ../../../etc/localtime
>    /usr/share/zoneinfo/posixrules -> localtime
>    /usr/share/zoneinfo/posixtime -> localtime

> You could acheive the same using the TZ variable like this:

>    TZ=Europe/Amsterdam
>    export TZ

> where you need to choose the right file name from the zoneinfo directory.

OK, this worked! Only difference, on my system (SuSE) zoneinfo is at

        /usr/lib/zoneinfo

I exported

        TZ=US/Central

I am still confused about why this is needed for regular users, but by
root. Can you enlighten me on that?

Thanks!
--
Robert Paulsen                         http://paulsen.home.texas.net
If my return address contains "ZAP." please remove it. Sorry for the
inconvenience but the unsolicited email is getting out of control.

 
 
 

GMT vs. Local Time -- Some help please!

Post by Robert C. Paulsen, Jr » Mon, 15 Feb 1999 04:00:00



> Robert,

> Log in as root, and echo $TZ. Then put a line in /etc/profile (or whatever
> your global profile script is) that sets this for all users.

> Regards,

As I noted in a reply to another helpful message, neither root nor user
have TZ set in their environment, but setting it does work. Thanks.

I tried both of the following and each worked:

        TZ=CST6CDT
        TZ=US/Central

Do you know why root gets it right without the TZ but normal users
don't?

--
Robert Paulsen                         http://paulsen.home.texas.net
If my return address contains "ZAP." please remove it. Sorry for the
inconvenience but the unsolicited email is getting out of control.

 
 
 

GMT vs. Local Time -- Some help please!

Post by Villy Kru » Mon, 15 Feb 1999 04:00:00




Quote:

>OK, this worked! Only difference, on my system (SuSE) zoneinfo is at

>    /usr/lib/zoneinfo

>I exported

>    TZ=US/Central

>I am still confused about why this is needed for regular users, but by
>root. Can you enlighten me on that?

No, not realy.  I works without TZ for root and others on my systems.

Maybe if you do 'strace date' you might be able to spot a difference
for root and non-root when trying to open the time zone file.

execve("/bin/date", ["date"], [/* 19 vars */]) = 0
   .............. snipped the start up overhead ..................
open("/etc/localtime", O_RDONLY)        = 3
fstat(3, {st_mode=0, st_size=0, ...})   = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400b4000
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 1058
close(3)                                = 0
munmap(0x400b4000, 4096)                = 0
fstat(1, {st_mode=0, st_size=0, ...})   = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400b4000
write(1, "Sun Feb 14 14:29:24 CET 1999\n", 29Sun Feb 14 14:29:24 CET 1999
) = 29
close(1)                                = 0
munmap(0x400b4000, 4096)                = 0
_exit(0)                                = ?

 
 
 

GMT vs. Local Time -- Some help please!

Post by Robert C. Paulsen, Jr » Mon, 15 Feb 1999 04:00:00





> >OK, this worked! Only difference, on my system (SuSE) zoneinfo is at

> >       /usr/lib/zoneinfo

> >I exported

> >       TZ=US/Central

> >I am still confused about why this is needed for regular users, but by
> >root. Can you enlighten me on that?

> No, not realy.  I works without TZ for root and others on my systems.

> Maybe if you do 'strace date' you might be able to spot a difference
> for root and non-root when trying to open the time zone file.

OK, you are on to something here! Note the "Permission denied" in the
strace extract below. If I set the TZ variable, there is no attempt to
access zoneinfo/localtime, but instead it goes to zoneinfo/US/Central
which works.

The permissions on localtime were       -rw-r-----
Changing this to                        -rw-r--r--

made it all work without TZ being set.

I think I got into this because I changed my umask to 027 in an attempt
to tighten up security. I guess it makes it so secure the users can't
even figure out what time zone they are in!

=======[ strace extract ]========================

Quote:> time([918999851])                       = 918999851
> open("/usr/lib/zoneinfo/localtime", O_RDONLY) = -1 EACCES (Permission denied)
> open("/usr/lib/zoneinfo/GMT", O_RDONLY) = 3
> read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 6460) = 56

46,48c47,50
< time(NULL)                              = 918999860
< open("/usr/lib/zoneinfo/localtime", O_RDONLY) = 3
< read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 6460) = 1262
---
Quote:> time(NULL)                              = 918999851
> open("/usr/lib/zoneinfo/localtime", O_RDONLY) = -1 EACCES (Permission denied)
> open("/usr/lib/zoneinfo/GMT", O_RDONLY) = 3
> read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 6460) = 56

=======[ strace extract ]========================

--
Robert Paulsen                         http://paulsen.home.texas.net
If my return address contains "ZAP." please remove it. Sorry for the
inconvenience but the unsolicited email is getting out of control.

 
 
 

GMT vs. Local Time -- Some help please!

Post by jrre.. » Sat, 20 Feb 1999 04:00:00




>This is actually normal on linux systems.

>On a redhat system this is defined by some symbolic links like this.

>   /etc/localtime -> ../usr/share/zoneinfo/Europe/Amsterdam
>   /usr/share/zoneinfo/localtime -> ../../../etc/localtime
>   /usr/share/zoneinfo/posixrules -> localtime
>   /usr/share/zoneinfo/posixtime -> localtime

>You could acheive the same using the TZ variable like this:

>   TZ=Europe/Amsterdam
>   export TZ

>where you need to choose the right file name from the zoneinfo directory.

You know, I've got a different spin on this: All of the links that you
suggest *are* in-place for me, date works just fine both as root and as a
plain user; yet, on email messages that go out for me, I get GMT (+0000)
in the email headers.  There are other tell-tale signs of some sort of
time problem.

FWIW, I'm running RedHat 5.2 Linux and sendmail as my MTA.   Uname
returns:

Quote:> uname -a

Linux saix735 2.0.36 #1 Tue Oct 13 22:17:11 EDT 1998 i686 unknown

Any thoughts?

thanks,
john

 
 
 

GMT vs. Local Time -- Some help please!

Post by John Red-Hor » Sat, 20 Feb 1999 04:00:00


I love it when I get to follow-up my own posts..


>You know, I've got a different spin on this: All of the links that you
>suggest *are* in-place for me, date works just fine both as root and as a
>plain user; yet, on email messages that go out for me, I get GMT (+0000)
>in the email headers.  There are other tell-tale signs of some sort of
>time problem.


the heart of this problem:

One has to create a symbolic from /usr/lib/zoneinfo to
/usr/share/zoneinfo.  

Apparently, a bunch of programs have this statically compiled in.

Thanks, Robert.

cheers,
john