Gorgon Game Engine
Gorgon::Time Namespace Reference

This module contains time related information. More...

Namespaces

 internal
 

Classes

class  Date
 This class represents a specific date including time information. More...
 
class  Timer
 Millisecond based timer. More...
 

Functions

unsigned long DeltaTime ()
 Returns the time passed since the last frame. More...
 
unsigned long FrameStart ()
 Returns start time of the current frame in milliseconds. More...
 
void fromtm (Date &ret, tm timeinfo)
 
Date GetDate ()
 Returns the current date. More...
 
unsigned long GetTime ()
 Returns current time in milliseconds. More...
 
void Initialize ()
 Initializes Time module. More...
 
std::ostream & operator<< (std::ostream &out, const Date &date)
 Output stream operator overload. More...
 
std::ostream & operator<< (std::ostream &output, const Timer &timer)
 Allows Timer to be printed. More...
 
tm totm (const Date &d)
 

Detailed Description

This module contains time related information.

Function Documentation

◆ DeltaTime()

unsigned long Gorgon::Time::DeltaTime ( )

Returns the time passed since the last frame.

This value is updated at the start of the frame.

References Gorgon::Time::internal::deltatime.

◆ FrameStart()

unsigned long Gorgon::Time::FrameStart ( )

Returns start time of the current frame in milliseconds.

This function should be used for animations and effects as it is constant throughout a frame.

References Gorgon::Time::internal::framestart.

◆ fromtm()

void Gorgon::Time::fromtm ( Date ret,
tm  timeinfo 
)

◆ GetDate()

Date GetDate ( )

Returns the current date.

Should not be used for performance calculations, its not guaranteed to be precise.

References Date::Day, Date::Hour, Date::Millisecond, Date::Minute, Date::Month, Date::Second, Date::Timezone, Date::Weekday, and Date::Year.

◆ GetTime()

unsigned long GetTime ( )

Returns current time in milliseconds.

Warning
FrameStart should be used unless exact time is required. This function works slower and changes during a frame, which may cause synchronization issues.

◆ Initialize()

void Initialize ( )

Initializes Time module.

Initializes the filesystem module.

Gorgon system requires every module to have initialization function even if they are not used. Currently used for following tasks:

  • Set startup directory

    There is a mechanism to ensure initialization is performed once.

References Gorgon::Time::internal::deltatime, Gorgon::Time::internal::framestart, and GetTime().

◆ operator<<() [1/2]

std::ostream& Gorgon::Time::operator<< ( std::ostream &  out,
const Date date 
)

Output stream operator overload.

References Date::ISODateTime().

◆ operator<<() [2/2]

std::ostream& Gorgon::Time::operator<< ( std::ostream &  output,
const Timer timer 
)

Allows Timer to be printed.

References Timer::Get().

◆ totm()

tm Gorgon::Time::totm ( const Date d)