[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

timezone = 1168 ???



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


Reply to: