On Wed, 13 Jan 1999, Edwin Martin wrote: > Hello, > > I walked into a strange problem. > > The variable timezone doesn't seem to work right. It should give > the timedifference between GMT and the local timezone. > > I live in Amsterdam, so the difference should be (-)3600 seconds. > But timezone tells me the difference is -1168 seconds, or about > 19 minutes! Bit strange, isn't it? > > I use Debian Hamm, so my Linux is not that old. I can reproduce this > on two Hamm-computers, installed by different people. > > Here's the code: > > // timetest.c > > #include <stdio.h> > #include <time.h> > > main() { > time_t t; > > t = time( NULL ); // dummy instruction for localtime() > localtime( &t ); // sets tzname and timezone > > printf( "tzname=[%s,%s]\n", tzname[0], tzname[1] ); > printf( "timezone=%ld\n", timezone ); > } > > And this is the output: > > tzname=[CET,CEST] > timezone=-1168 > > tzname Is correct, but timezone is not. > > Can anybody explain this? Is this a bug in glibc or something? > > Thanx, > Edwin Martin. > > > --- > The world is moving so fast these days > that the person who says it can't be done > is generally interrupted by someone doing it. > -- Harry Emerson Fosdick > >
I've noticed a similar problem on my system. I first noticed me when someone pointed out to me that my mail's time says "-0600 (EST)" which is, of course, incorrect. It should read CST. I asked what was going on once, but no one responded. I ran your little program and got this output: tzname=[EST,CDT] timezone=21600 That should be CST,CDT and 3600. Does anyone know what's going on here? I almost forgot. I did not have this problem under bo. It began with hamm and has continued into slink. /----------------------------------------------------------\ | pretzelgod | [EMAIL PROTECTED] | | (Eric Gillespie, Jr.) | [EMAIL PROTECTED] | |---------------------------<*>----------------------------| | "That's the problem with going from a soldier to a | | politician: you actually have to sit down and listen to | | people who six months ago you would've just shot." | | --President John Sheridan, Babylon 5 | \----------------------------------------------------------/