AnsweredAssumed Answered

localtime issue

Question asked by gombos on Jul 27, 2012
Latest reply on Jul 31, 2012 by James.Kosin

Hi,

I found a strange issue. I need to know the distance in seconds between UTC time and local time included DST. I use the following function to get it:

 

int getTzOffset(void)

{

time_t currtime;

struct tm *timeinfo;

 

time(&currtime);

timeinfo = localtime(&currtime);

return timeinfo->tm_gmtoff;

}

 

Quite simple, isn't it? I'm sitting in GMT+1 and now it is summer time. So I expect the tm_gmtoff is 7200 and tm_isdst is 1. It is true if I run this code on my linux pc but on bf-537 I receive 3600 and 0 for tm_isdst.

My TZ file contains this:

LST-1LDT,M3.5.0/2:00:00,M10.5.0/3:00:00

Otherwise the local time calculation is perfect.

Outcomes