From bb3663d94fd5db95c1dcb21a6b68eede664aa1be Mon Sep 17 00:00:00 2001 From: SilverIce Date: Mon, 8 Nov 2010 01:02:57 +0200 Subject: [PATCH] [10694] Use portable ACE way msecs time value calculation Avoid use unsafe code for non-Windows platforms Thanks to Marik for research the problem and Ambal for helping me with this patch --- src/shared/Timer.h | 25 ++++--------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/shared/Timer.h b/src/shared/Timer.h index 5acf0af1b..668553353 100644 --- a/src/shared/Timer.h +++ b/src/shared/Timer.h @@ -19,31 +19,14 @@ #ifndef MANGOS_TIMER_H #define MANGOS_TIMER_H -#include "Platform/CompilerDefs.h" +#include "Common.h" +#include -#if PLATFORM == PLATFORM_WINDOWS -# include -# include -# include -#else -# if defined(__APPLE_CC__) -# include -# endif -# include -# include -#endif - -#if PLATFORM == PLATFORM_WINDOWS -inline uint32 getMSTime() { return GetTickCount(); } -#else inline uint32 getMSTime() { - struct timeval tv; - struct timezone tz; - gettimeofday( &tv, &tz ); - return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); + static const ACE_Time_Value ApplicationStartTime = ACE_OS::gettimeofday(); + return (ACE_OS::gettimeofday() - ApplicationStartTime).msec(); } -#endif inline uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 711939db2..2e36fdecf 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10693" + #define REVISION_NR "10694" #endif // __REVISION_NR_H__