* 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