Mailinglist Archive: opensuse (3378 mails)

< Previous Next >
Re: [SLE] timezone question
  • From: Gerhard den Hollander <gerhard@xxxxxxxxxxxx>
  • Date: Wed, 10 Apr 2002 14:58:11 +0200
  • Message-id: <20020410145811.Q20135@xxxxxxxxxxxxxxxxx>
* Berge, Harry ten <berge@xxxxxxx> (Wed, Apr 10, 2002 at 02:11:39PM +0200)
> 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?

% grep TIMEZONE /etc/rc.config
TIMEZONE="Europe/Amsterdam"
% grep GMT /etc/rc.config
GMT="--localtime"

>> -----Original Message-----
>> From: Gerhard den Hollander [SMTP:gerhard@xxxxxxxxxxxx]
>> 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 <berge@xxxxxxx> (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 <time.h>
>> #include <stdio.h>
>>
>>
>>
>> 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 ...
>>
Kind regards,
--
Gerhard den Hollander Phone :+31-10.280.1515
Global IT Support manager Direct:+31-10.280.1539
Jason Geosystems BV Fax :+31-10.280.1511
(When calling please note: we are in GMT+1)
gdenhollander@xxxxxxxxxxxx POBox 1573
visit us at http://www.jasongeo.com 3000 BN Rotterdam
JASON.......#1 in Reservoir Characterization The Netherlands

This e-mail and any attachment is/are intended solely for the named
addressee(s) and may contain information that is confidential and privileged.
If you are not the intended recipient, we request that you do not
disseminate, forward, distribute or copy this e-mail message.
If you have received this e-mail message in error, please notify us
immediately by telephone and destroy the original message.

< Previous Next >
References