diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 01ff12dec6..b802dfce7b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,10 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-30 06:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * source/common/hbdate.c + ! Refixed for HB_HAS_LOCALTIME_R. + 2009-07-30 06:48 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * source/common/hbdate.c ! Fixed typos in last modif. diff --git a/harbour/source/common/hbdate.c b/harbour/source/common/hbdate.c index 7696674d36..7de8b03d43 100644 --- a/harbour/source/common/hbdate.c +++ b/harbour/source/common/hbdate.c @@ -912,20 +912,20 @@ long hb_timeUTCOffset( void ) /* in seconds */ } #else { - struct tm * timeinfo; + struct tm timeinfo; time_t current, utc, local; time( ¤t ); - timeinfo = gmtime( ¤t ); - utc = mktime( timeinfo ); -# if defined( HB_HAS_LOCALTIME_R ) - localtime_r( ¤t, timeinfo ); -# else - timeinfo = localtime( ¤t ); -# endif - local = mktime( timeinfo ); + utc = mktime( gmtime( ¤t ) ); - return difftime( local, utc ) + ( timeinfo->tm_isdst ? 3600 : 0 ); +#if defined( HB_HAS_LOCALTIME_R ) + localtime_r( ¤t, &timeinfo ); +#else + timeinfo = *localtime( ¤t ); +#endif + local = mktime( &timeinfo ); + + return difftime( local, utc ) + ( timeinfo.tm_isdst ? 3600 : 0 ); } #endif }