TrinityCore
Loading...
Searching...
No Matches
Timer.h File Reference
#include "Define.h"
#include "Duration.h"
+ 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  PeriodicTimer
 

Functions

TimePoint GetApplicationStartTime ()
 
uint32 getMSTime ()
 
uint32 getMSTimeDiff (uint32 oldMSTime, uint32 newMSTime)
 
uint32 getMSTimeDiff (uint32 oldMSTime, TimePoint newTime)
 
uint32 GetMSTimeDiffToNow (uint32 oldMSTime)
 

Function Documentation

◆ GetApplicationStartTime()

TimePoint GetApplicationStartTime ( )
inline

Definition at line 24 of file Timer.h.

25{
26 using namespace std::chrono;
27
28 static const steady_clock::time_point ApplicationStartTime = steady_clock::now();
29
30 return ApplicationStartTime;
31}
+ Here is the caller graph for this function:

◆ getMSTime()

uint32 getMSTime ( )
inline

Definition at line 33 of file Timer.h.

34{
35 using namespace std::chrono;
36
37 return uint32(duration_cast<milliseconds>(steady_clock::now() - GetApplicationStartTime()).count());
38}
uint32_t uint32
Definition: Define.h:143
TimePoint GetApplicationStartTime()
Definition: Timer.h:24
+ Here is the call graph for this function:

◆ getMSTimeDiff() [1/2]

uint32 getMSTimeDiff ( uint32  oldMSTime,
TimePoint  newTime 
)
inline

Definition at line 49 of file Timer.h.

50{
51 using namespace std::chrono;
52
53 uint32 newMSTime = uint32(duration_cast<milliseconds>(newTime - GetApplicationStartTime()).count());
54 return getMSTimeDiff(oldMSTime, newMSTime);
55}
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition: Timer.h:40
+ Here is the call graph for this function:

◆ getMSTimeDiff() [2/2]

uint32 getMSTimeDiff ( uint32  oldMSTime,
uint32  newMSTime 
)
inline

Definition at line 40 of file Timer.h.

41{
42 // getMSTime() have limited data range and this is case when it overflow in this tick
43 if (oldMSTime > newMSTime)
44 return (0xFFFFFFFF - oldMSTime) + newMSTime;
45 else
46 return newMSTime - oldMSTime;
47}
+ Here is the caller graph for this function:

◆ GetMSTimeDiffToNow()

uint32 GetMSTimeDiffToNow ( uint32  oldMSTime)
inline

Definition at line 57 of file Timer.h.

58{
59 return getMSTimeDiff(oldMSTime, getMSTime());
60}
uint32 getMSTime()
Definition: Timer.h:33
+ Here is the call graph for this function: