diff options
author | Patrick Luby <pluby@openoffice.org> | 2001-03-08 21:27:08 +0000 |
---|---|---|
committer | Patrick Luby <pluby@openoffice.org> | 2001-03-08 21:27:08 +0000 |
commit | 3851324f0fa7d47b2ca5af2b02b07b19e8d96af1 (patch) | |
tree | 4eb3a5f18d66f62aace00af794be3d654d69f21b /sal/osl | |
parent | 1383847a385c5d6f9bcc2e04dc0b21824d936dd3 (diff) |
Replace ftime calls with gettimeofday calls as ftime is obsolete in Linux and Mac OS X
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/unx/time.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sal/osl/unx/time.c b/sal/osl/unx/time.c index cd0cb189f..9e90543a8 100644 --- a/sal/osl/unx/time.c +++ b/sal/osl/unx/time.c @@ -2,9 +2,9 @@ * * $RCSfile: time.c,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mfe $ $Date: 2001-02-27 15:49:07 $ + * last change: $Author: pluby $ $Date: 2001-03-08 22:27:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,7 +64,6 @@ #include <osl/diagnose.h> #include <osl/time.h> -#include <sys/timeb.h> sal_Bool SAL_CALL osl_getSystemTime(TimeValue* TimeValue) @@ -252,23 +251,24 @@ sal_Bool SAL_CALL osl_getSystemTimeFromLocalTime( TimeValue* pLocalTimeVal, Time -static struct timeb startTime; +static struct timeval startTime; +static struct timezone timeZone; static sal_Bool bGlobalTimer = sal_False; sal_uInt32 SAL_CALL osl_getGlobalTimer() { - struct timeb currentTime; + struct timeval currentTime; sal_uInt32 nSeconds; if ( bGlobalTimer == sal_False ) { - ftime( &startTime ); + gettimeofday( &startTime, &timeZone ); bGlobalTimer=sal_True; } - ftime( ¤tTime ); + gettimeofday( ¤tTime, &timeZone ); - nSeconds = (sal_uInt32)( currentTime.time - startTime.time ); + nSeconds = (sal_uInt32)( currentTime.tv_sec - startTime.tv_sec ); - return ( nSeconds * 1000 ) + (long)( currentTime.millitm - startTime.millitm ); + return ( nSeconds * 1000 ) + (long)( currentTime.tv_usec - startTime.tv_usec); } |