This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Various] timezone issues



I'm appending a bug report from bug-glibc together with two followups
answers.  There seems to be a (new?) bug in the timezone handling:

$ TZ="America/Los_Angeles" ./t
timezone is 28800
tzname[0] is PST
tzname[1] is PWT   <- This should be PDT, W means War

I don't have time to check why PWT is output instead of PDT.

Andreas
-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@alma.student.uni-kl.de


Topics:
   timezone issues
   Re: timezone issues
   Re: timezone issues 


----------------------------------------------------------------------

Date: Thu, 02 Jul 1998 09:59:34 -0700
From: Ahmon Dancy <dancy@franz.com>
To: bug-glibc@gnu.org
Subject: timezone issues
Message-Id: <199807021659.JAA20331@ultra.franz.com>

I think this is a bug:

x.c:


#include <stdio.h>
#include <time.h>

int main() {
        extern long timezone;
/*
    struct timezone tz;
    struct timeval tp;
*/

        tzset();
/*
    gettimeofday(&tp,&tz);
        printf("minutes west is %d\n", tz.tz_minuteswest);
*/
        printf("timezone is %d\n", timezone);
        printf("tzname[0] is %s\n", tzname[0]);
        printf("tzname[1] is %s\n", tzname[1]);
        return 0;
}


Output:
timezone is 0
tzname[0] is PST
tzname[1] is PWT


I think timezone should be 8 in my case... and tzname[1] should be
PDT.


I'm not sure how to figure how which version of glibc I'm using.  I'm
running RedHat Linux 5.0.  libc.so.6.  A fresh installation of RedHat
5.1 has the same results.

More information available upon request.


------------------------------

Date: 03 Jul 1998 00:14:26 +0200
From: Andreas Jaeger <aj@arthur.rhein-neckar.de>
To: Ahmon Dancy <dancy@franz.com>
Cc: bug-glibc@gnu.org
Subject: Re: timezone issues
Message-ID: <u8pvfnq4sd.fsf@arthur.rhein-neckar.de>
References: <199807021659.JAA20331@ultra.franz.com>
Content-Type: text/plain; charset=US-ASCII

>>>>> Ahmon Dancy writes:

 > I think this is a bug:

Please tell me how you set the timezone (TZ variable,..) and to which
value you set it.  I guessed some values and hope they're ok ;-)

 > Output:
 > timezone is 0
 > tzname[0] is PST
 > tzname[1] is PWT


 > I think timezone should be 8 in my case... and tzname[1] should be
 > PDT.
timezone is in minutes.  The manual says:
 - Variable: long int timezone
     This contains the difference between UTC and the latest local
     standard time, in seconds west of UTC.  For example, in the U.S.
     Eastern time zone, the value is `5*60*60'.  Unlike the `tm_gmtoff'
     member of the broken-down time structure, this value is not
     adjusted for daylight saving, and its sign is reversed.  In GNU
     programs it is better to use `tm_gmtoff', since it contains the
     correct offset even when it is not the latest one.

Btw. there was a bug in the timezone calculation until glibc 2.0.6,
the newer glibc 2.0.7 snapshots follow the above documentation.

 > I'm not sure how to figure how which version of glibc I'm using.  I'm
 > running RedHat Linux 5.0.  libc.so.6.  A fresh installation of RedHat
 > 5.1 has the same results.

rpm should give you the version of your installed libc - but don't ask
me for details about rpm.

With your test program I get:
$ TZ="America/Los_Angeles" ./t
timezone is 28800
tzname[0] is PST
tzname[1] is PWT

28800 = 8 * 60 * 60 is ok but PWT is wrong.

Uli, can you look into it?

Andreas
- - 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@alma.student.uni-kl.de


------------------------------

Date: Thu, 02 Jul 1998 15:35:00 -0700
From: Ahmon Dancy <dancy@franz.com>
To: Andreas Jaeger <aj@arthur.rhein-neckar.de>
cc: bug-glibc@gnu.org
Subject: Re: timezone issues 
Message-Id: <199807022235.PAA22697@ultra.franz.com>

>> >>>>> Ahmon Dancy writes:
>> 
>>  > I think this is a bug:
>> 
>> Please tell me how you set the timezone (TZ variable,..) and to which
>> value you set it.  I guessed some values and hope they're ok ;-)

I have TZ unset.

>> 
>>  > Output:
>>  > timezone is 0
>>  > tzname[0] is PST
>>  > tzname[1] is PWT
>> 
>> 
>>  > I think timezone should be 8 in my case... and tzname[1] should be
>>  > PDT.
>> timezone is in minutes.  

Right you are.  In that case, It should be 28800. 

>>  The manual says:
>>  - Variable: long int timezone
>>      This contains the difference between UTC and the latest local
>>      standard time, in seconds west of UTC.  For example, in the U.S.
>>      Eastern time zone, the value is `5*60*60'.  Unlike the `tm_gmtoff'
>>      member of the broken-down time structure, this value is not
>>      adjusted for daylight saving, and its sign is reversed.  In GNU
>>      programs it is better to use `tm_gmtoff', since it contains the
>>      correct offset even when it is not the latest one.
>> 
>> Btw. there was a bug in the timezone calculation until glibc 2.0.6,
>> the newer glibc 2.0.7 snapshots follow the above documentation.
>> 
>>  > I'm not sure how to figure how which version of glibc I'm using.  I'm
>>  > running RedHat Linux 5.0.  libc.so.6.  A fresh installation of RedHat
>>  > 5.1 has the same results.
>> 
>> rpm should give you the version of your installed libc - but don't ask
>> me for details about rpm.

Here's some info:

System 1:

# rpm -q -a | grep libc
libc-5.3.12-24
rpm-2.4.10-1glibc
rpm-devel-2.4.10-1glibc
glibc-devel-2.0.7-6
glibc-2.0.7-6

System 2:

# rpm -q -a | grep libc
glibc-2.0.7-13
glibc-devel-2.0.7-13
libc-5.3.12-27


Both systems exhibit the same behaviour.



>> 
>> With your test program I get:
>> $ TZ="America/Los_Angeles" ./t
>> timezone is 28800
>> tzname[0] is PST
>> tzname[1] is PWT
>> 
>> 28800 = 8 * 60 * 60 is ok but PWT is wrong.
>> 
>> Uli, can you look into it?
>> 
>> Andreas
>> -- 
>>  Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
>>   for pgp-key finger ajaeger@alma.student.uni-kl.de
>> 
>> 


------------------------------

End of forward0OAFeX Digest
***************************



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]