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:
@@ -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.
|
||||
|
||||
@@ -916,16 +916,16 @@ long hb_timeUTCOffset( void ) /* in seconds */
|
||||
time_t current, utc, local;
|
||||
|
||||
time( ¤t );
|
||||
utc = mktime( gmtime( ¤t ) );
|
||||
|
||||
#if defined( HB_HAS_LOCALTIME_R )
|
||||
localtime_r( ¤t, &timeinfo );
|
||||
utc = mktime( gmtime_r( ¤t, &timeinfo ) );
|
||||
local = mktime( localtime_r( ¤t, &timeinfo ) );
|
||||
#else
|
||||
utc = mktime( gmtime( ¤t ) );
|
||||
timeinfo = *localtime( ¤t );
|
||||
#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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user