aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Utilities/Timer.h
diff options
context:
space:
mode:
authorclick <none@none>2010-11-08 17:24:16 +0100
committerclick <none@none>2010-11-08 17:24:16 +0100
commitb2f3b3d3294713eb1a46803fbcdd154d076cb22a (patch)
tree54de92b10174b462cc1f68c40def9a293c9ac70e /src/server/shared/Utilities/Timer.h
parentb1bf8ebfe62e18aa79195d1ae47f432d3a666d41 (diff)
Core: Use portable ACE-methods to do millisec time-value calculation (patch by SilverIce)
(also avoids some unsafe code on non-Windows platforms) --HG-- branch : trunk
Diffstat (limited to 'src/server/shared/Utilities/Timer.h')
-rwxr-xr-xsrc/server/shared/Utilities/Timer.h24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/server/shared/Utilities/Timer.h b/src/server/shared/Utilities/Timer.h
index 9db190f907f..ee27892ad34 100755
--- a/src/server/shared/Utilities/Timer.h
+++ b/src/server/shared/Utilities/Timer.h
@@ -19,31 +19,13 @@
#ifndef TRINITY_TIMER_H
#define TRINITY_TIMER_H
-#include "CompilerDefs.h"
-
-#if PLATFORM == PLATFORM_WINDOWS
-# include <ace/config-all.h>
-# include <mmsystem.h>
-# include <time.h>
-#else
-# if defined(__APPLE_CC__)
-# include <time.h>
-# endif
-# include <sys/time.h>
-# include <sys/timeb.h>
-#endif
+#include "Common.h"
-#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)
{