OregonCore  revision 3611e8a-git
Your Favourite TBC server
Timer.h File Reference
#include "Platform/CompilerDefs.h"
#include "Common.h"
#include <mmsystem.h>

Go to the source code of this file.

Classes

class  IntervalTimer
 
struct  TimeTracker
 
struct  TimeTrackerSmall
 
struct  PeriodicTimer
 

Functions

uint32 getMSTime ()
 
uint64 getMSTime64 ()
 
uint32 getMSTimeDiff (uint32 oldMSTime, uint32 newMSTime)
 
uint64 getMSTimeDiff64 (uint64 t1, uint64 t2)
 
uint32 GetMSTimeDiffToNow (uint32 oldMSTime)
 

Function Documentation

uint64 getMSTime64 ( )
inline

Definition at line 37 of file Timer.h.

References getMSTime().

Referenced by WorldSession::Update().

38 {
39  #if _WIN32_WINNT >= 0x0600 // Vista and higher
40  return GetTickCount64();
41  #else // Backwards compatibility for XP and lower
42  static uint32 previous = 0;
43  static uint64 total = 0;
44  uint32 now = GetTickCount();
45  total += (previous > now) ? (0xFFFFFFFF - previous) + now : (now - previous);
46  previous = now;
47  return total;
48  #endif
49 }
ACE_UINT64 uint64
Definition: Define.h:70
ACE_UINT32 uint32
Definition: Define.h:71
uint32 getMSTimeDiff ( uint32  oldMSTime,
uint32  newMSTime 
)
inline

Definition at line 78 of file Timer.h.

Referenced by Database::_Query(), Database::DirectExecute(), Unit::GetDiminishing(), GetMSTimeDiffToNow(), Unit::IsUnderLastManaUseEffect(), LoadGameObjectModelList(), Master::MainLoop(), World::RecordTimeDiff(), FreezeDetectorRunnable::run(), and World::SetInitialWorldSettings().

79 {
80  // getMSTime() have limited data range and this is case when it overflow in this tick
81  if (oldMSTime > newMSTime)
82  return (0xFFFFFFFF - oldMSTime) + newMSTime;
83  else
84  return newMSTime - oldMSTime;
85 }
uint64 getMSTimeDiff64 ( uint64  t1,
uint64  t2 
)
inline

Definition at line 87 of file Timer.h.

Referenced by WorldSession::Update().

88 {
89  if (t1 > t2)
90  return t1 - t2;
91  return t2 - t1;
92 }
uint32 GetMSTimeDiffToNow ( uint32  oldMSTime)
inline

Definition at line 94 of file Timer.h.

References getMSTime(), and getMSTimeDiff().

Referenced by CreatureTextMgr::LoadCreatureTextLocales(), CreatureTextMgr::LoadCreatureTexts(), SmartWaypointMgr::LoadFromDB(), SmartAIMgr::LoadHelperStores(), SmartAIMgr::LoadSmartAIFromDB(), ObjectMgr::LoadTempSummons(), main(), and Player::Update().

95 {
96  return getMSTimeDiff(oldMSTime, getMSTime());
97 }
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition: Timer.h:78
uint32 getMSTime()
Definition: Timer.h:32