2009-07-30 08:48 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* source/common/hbdate.c
    + Enhancement to hb_timeUTCOffset(). (using thread safe 
      version of gmtime() where available, and precisely checking 
      tm_isdst). Thanks to Przemek.
This commit is contained in:
Viktor Szakats
2009-07-30 06:50:56 +00:00
parent 0e4021d699
commit 1237de4177
2 changed files with 11 additions and 5 deletions

View File

@@ -17,6 +17,12 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-07-30 08:48 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* source/common/hbdate.c
+ Enhancement to hb_timeUTCOffset(). (using thread safe
version of gmtime() where available, and precisely checking
tm_isdst). Thanks to Przemek.
2009-07-30 06:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* source/common/hbdate.c
! Refixed for HB_HAS_LOCALTIME_R.

View File

@@ -916,16 +916,16 @@ long hb_timeUTCOffset( void ) /* in seconds */
time_t current, utc, local;
time( &current );
utc = mktime( gmtime( &current ) );
#if defined( HB_HAS_LOCALTIME_R )
localtime_r( &current, &timeinfo );
utc = mktime( gmtime_r( &current, &timeinfo ) );
local = mktime( localtime_r( &current, &timeinfo ) );
#else
utc = mktime( gmtime( &current ) );
timeinfo = *localtime( &current );
#endif
local = mktime( &timeinfo );
return difftime( local, utc ) + ( timeinfo.tm_isdst ? 3600 : 0 );
#endif
return difftime( local, utc ) + ( timeinfo.tm_isdst > 0 ? 3600 : 0 );
}
#endif
}