TrinityCore
Loading...
Searching...
No Matches
GameTime Namespace Reference

Functions

time_t GetStartTime ()
 
time_t GetGameTime ()
 
uint32 GetGameTimeMS ()
 
SystemTimePoint GetSystemTime ()
 Current chrono system_clock time point. More...
 
TimePoint Now ()
 Current chrono steady_clock time point. More...
 
template<typename Clock >
Clock::time_point GetTime ()
 Current chrono Clock time point. More...
 
template<>
TC_GAME_API SystemTimePoint GetTime< std::chrono::system_clock > ()
 
template<>
TC_GAME_API TimePoint GetTime< std::chrono::steady_clock > ()
 
uint32 GetUptime ()
 Uptime (in secs) More...
 
tm const * GetDateAndTime ()
 
void UpdateGameTimers ()
 

Variables

time_t const StartTime = time(nullptr)
 
time_t GameTime = time(nullptr)
 
uint32 GameMSTime = 0
 
SystemTimePoint GameTimeSystemPoint = SystemTimePoint::min()
 
TimePoint GameTimeSteadyPoint = TimePoint::min()
 
tm DateTime
 

Function Documentation

◆ GetDateAndTime()

TC_GAME_API tm const * GameTime::GetDateAndTime ( )

Definition at line 82 of file GameTime.cpp.

83 {
84 return &DateTime;
85 }
tm DateTime
Definition: GameTime.cpp:32
+ Here is the caller graph for this function:

◆ GetGameTime()

TC_GAME_API time_t GameTime::GetGameTime ( )

Definition at line 39 of file GameTime.cpp.

40 {
41 return GameTime;
42 }

◆ GetGameTimeMS()

TC_GAME_API uint32 GameTime::GetGameTimeMS ( )

Definition at line 44 of file GameTime.cpp.

45 {
46 return GameMSTime;
47 }
uint32 GameMSTime
Definition: GameTime.cpp:27
+ Here is the caller graph for this function:

◆ GetStartTime()

TC_GAME_API time_t GameTime::GetStartTime ( )

Definition at line 34 of file GameTime.cpp.

35 {
36 return StartTime;
37 }
time_t const StartTime
Definition: GameTime.cpp:24
+ Here is the caller graph for this function:

◆ GetSystemTime()

TC_GAME_API SystemTimePoint GameTime::GetSystemTime ( )

Current chrono system_clock time point.

Definition at line 49 of file GameTime.cpp.

50 {
52 }
SystemTimePoint GameTimeSystemPoint
Definition: GameTime.cpp:29
+ Here is the caller graph for this function:

◆ GetTime()

template<typename Clock >
Clock::time_point GameTime::GetTime ( )

Current chrono Clock time point.

Definition at line 60 of file GameTime.cpp.

61 {
62 static_assert(!std::is_same<Clock, Clock>::value, "Missing specialization for GetGameTimePoint");
63 }

◆ GetTime< std::chrono::steady_clock >()

template<>
TC_GAME_API TimePoint GameTime::GetTime< std::chrono::steady_clock > ( )

Definition at line 72 of file GameTime.cpp.

73 {
74 return Now();
75 }
TimePoint Now()
Current chrono steady_clock time point.
Definition: GameTime.cpp:54
+ Here is the call graph for this function:

◆ GetTime< std::chrono::system_clock >()

template<>
TC_GAME_API SystemTimePoint GameTime::GetTime< std::chrono::system_clock > ( )

Definition at line 66 of file GameTime.cpp.

67 {
68 return GetSystemTime();
69 }
SystemTimePoint GetSystemTime()
Current chrono system_clock time point.
Definition: GameTime.cpp:49
+ Here is the call graph for this function:

◆ GetUptime()

TC_GAME_API uint32 GameTime::GetUptime ( )

Uptime (in secs)

Definition at line 77 of file GameTime.cpp.

78 {
79 return uint32(GameTime - StartTime);
80 }
uint32_t uint32
Definition: Define.h:143
+ Here is the caller graph for this function:

◆ Now()

TC_GAME_API TimePoint GameTime::Now ( )

Current chrono steady_clock time point.

Definition at line 54 of file GameTime.cpp.

55 {
57 }
TimePoint GameTimeSteadyPoint
Definition: GameTime.cpp:30
+ Here is the caller graph for this function:

◆ UpdateGameTimers()

void GameTime::UpdateGameTimers ( )

Definition at line 87 of file GameTime.cpp.

88 {
89 GameTime = time(nullptr);
91 GameTimeSystemPoint = std::chrono::system_clock::now();
92 GameTimeSteadyPoint = std::chrono::steady_clock::now();
93 localtime_r(&GameTime, &DateTime);
94 }
uint32 getMSTime()
Definition: Timer.h:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ DateTime

tm GameTime::DateTime

Definition at line 32 of file GameTime.cpp.

◆ GameMSTime

uint32 GameTime::GameMSTime = 0

Definition at line 27 of file GameTime.cpp.

◆ GameTime

time_t GameTime::GameTime = time(nullptr)

Definition at line 26 of file GameTime.cpp.

◆ GameTimeSteadyPoint

TimePoint GameTime::GameTimeSteadyPoint = TimePoint::min()

Definition at line 30 of file GameTime.cpp.

◆ GameTimeSystemPoint

SystemTimePoint GameTime::GameTimeSystemPoint = SystemTimePoint::min()

Definition at line 29 of file GameTime.cpp.

◆ StartTime

time_t const GameTime::StartTime = time(nullptr)

Definition at line 24 of file GameTime.cpp.