diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-05-19 18:09:21 -0500 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-05-20 10:31:14 +0000 |
commit | d8d55787b81cdc955b73c8befa4ab608f46e32aa (patch) | |
tree | 49c824ede45e247105e44990fe3f46d74d6c1f1f /sal/osl/w32 | |
parent | 235941bcd0e59c2831d5bc28683119eb6a2fd982 (diff) |
Thread-safe version of osl_getGlobalTime
Change-Id: Ibb9d23780600437f607d866ff3d396b96879245d
Reviewed-on: https://gerrit.libreoffice.org/3960
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'sal/osl/w32')
-rw-r--r-- | sal/osl/w32/salinit.cxx | 4 | ||||
-rw-r--r-- | sal/osl/w32/time.c | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/sal/osl/w32/salinit.cxx b/sal/osl/w32/salinit.cxx index e392f4ab3774..3eb9290a87fd 100644 --- a/sal/osl/w32/salinit.cxx +++ b/sal/osl/w32/salinit.cxx @@ -31,6 +31,9 @@ extern "C" { #endif +//From time.c +void sal_initGlobalTimer(); + // _set_invalid_parameter_handler appears unavailable with MinGW: #if defined _MSC_VER namespace { @@ -52,6 +55,7 @@ extern "C" void invalidParameterHandler( void sal_detail_initialize(int argc, char ** argv) { + sal_initGlobalTimer(); // SetProcessDEPPolicy(PROCESS_DEP_ENABLE); // SetDllDirectoryW(L""); // SetSearchPathMode( diff --git a/sal/osl/w32/time.c b/sal/osl/w32/time.c index 49f33c297c43..fc8855b53680 100644 --- a/sal/osl/w32/time.c +++ b/sal/osl/w32/time.c @@ -184,21 +184,17 @@ sal_Bool SAL_CALL osl_getSystemTimeFromLocalTime( TimeValue* pLocalTimeVal, Time return sal_False; } - static struct _timeb startTime; -static sal_Bool bGlobalTimer = sal_False; +void sal_initGlobalTimer() +{ + _ftime( &startTime ); +} sal_uInt32 SAL_CALL osl_getGlobalTimer(void) { struct _timeb currentTime; sal_uInt32 nSeconds; - if ( bGlobalTimer == sal_False ) - { - _ftime( &startTime ); - bGlobalTimer=sal_True; - } - _ftime( ¤tTime ); nSeconds = (sal_uInt32)( currentTime.time - startTime.time ); |