yes, your correct. This is what I want to, but with our settings the 2 times are exactly the same. What is the setting of your TZ env. variable?
-----Original Message----- From: Gerhard den Hollander [SMTP:gerhard@jasongeo.com] Sent: Wednesday, April 10, 2002 1:19 PM To: Berge, Harry ten Cc: SuSE general (E-mail) Subject: Re: [SLE] timezone question
* Berge, Harry ten
(Wed, Apr 10, 2002 at 11:25:56AM +0200) Hi,
We have an application which determines the timezone and if the daylight saving is active. To do this, the struct tm is used, and the functions localtime() and gmtime(). The problem is the application correctly says it is 'daylight saving active' for Solaris/Unix/WinNT, but for Linux not.
The system settings are:
GMT="--localtime" TIMEZONE="Europe/Amsterdam"
Has anyone an idea what whe are doing wrong?
#include
#include main() { struct tm * tm; time_t t; t = time(NULL); tm = gmtime(&t); printf("GMT: %s",asctime(tm)); printf("GMT: %d\n\n",tm->tm_isdst); tm = localtime(&t); printf("LOC: %s",asctime(tm)); printf("LOC: %d\n\n",tm->tm_isdst); }
gives GMT: Wed Apr 10 11:10:51 2002 GMT: 0
LOC: Wed Apr 10 13:10:51 2002 LOC: 1
which is exactly what I would expect .... or do you want asctime to say ``daylight savings time'' at the end ?
try strftime ...
Gerhard, <@jasongeo.com> == The Acoustic Motorbiker == -- __O If your watch is wound, wound to run, it will =`\<, If your time is due, due to come, it will (=)/(=) Living this life, is like trying to learn latin in a chines firedrill
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com
Also check the archives at http://lists.suse.com