TrinityCore
Timer.h File Reference
#include "Define.h"
#include <chrono>
+ Include dependency graph for Timer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  IntervalTimer
 
struct  TimeTracker
 
struct  TimeTrackerSmall
 
struct  PeriodicTimer
 

Functions

uint32 getMSTime ()
 
uint32 getMSTimeDiff (uint32 oldMSTime, uint32 newMSTime)
 
uint32 GetMSTimeDiffToNow (uint32 oldMSTime)
 

Function Documentation

◆ getMSTime()

uint32 getMSTime ( )
inline
25 {
26  using namespace std::chrono;
27 
28  static const steady_clock::time_point ApplicationStartTime = steady_clock::now();
29 
30  return uint32(duration_cast<milliseconds>(steady_clock::now() - ApplicationStartTime).count());
31 }
uint32_t uint32
Definition: Define.h:152

◆ getMSTimeDiff()

uint32 getMSTimeDiff ( uint32  oldMSTime,
uint32  newMSTime 
)
inline
34 {
35  // getMSTime() have limited data range and this is case when it overflow in this tick
36  if (oldMSTime > newMSTime)
37  return (0xFFFFFFFF - oldMSTime) + newMSTime;
38  else
39  return newMSTime - oldMSTime;
40 }
+ Here is the caller graph for this function:

◆ GetMSTimeDiffToNow()

uint32 GetMSTimeDiffToNow ( uint32  oldMSTime)
inline
43 {
44  return getMSTimeDiff(oldMSTime, getMSTime());
45 }
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition: Timer.h:33
uint32 getMSTime()
Definition: Timer.h:24
+ Here is the call graph for this function: