# Frost::TimeManager Class Reference

Keeper of time :). More...

`#include <frost_utils_timemanager.h>`

Inheritance diagram for Frost::TimeManager:

List of all members.

## Public Types

typedef s_double(* | GetTimeFunction )()

## Public Member Functions

void | SetGetTimeFunction (GetTimeFunction pFunc)
| Sets the timing function to use.
void | Initialize ()
| Initializes this manager.
void | Update ()
| Updates delta time and FPS.
s_double | GetDelta () const
| Returns the time elapsed since last frame.
const s_uint & | GetFPS () const
| Returns the current Frame Per Second (FPS) count.
s_uint | GetAverageFPS () const
| Returns average frame per second since game launch.
const s_uint & | GetBestFPS () const
| Returns the highest Frame Per Second (FPS) count.
const s_uint & | GetWorstFPS () const
| Returns the lowest Frame Per Second (FPS) count.
s_double | GetTime () const
| Returns the current time in seconds.
s_uint | GetYear () const
| Returns the current time (year).
s_uint | GetMonth () const
| Returns the current time (month).
s_uint | GetDayName () const
| Returns the current time (day name code).
s_uint | GetDay () const
| Returns the current time (day).
s_uint | GetHour () const
| Returns the current time (hours).
s_uint | GetMinutes () const
| Returns the current time (minutes).
s_uint | GetMicroseconds () const
| Returns the current time (microseconds).
s_str | GetPlayTime () const
| Returns the time elapsed since game's start.
s_uint | GetSeconds () const
| Returns the current time (seconds).
void | SetProfiling (const s_bool &bProfiling)
| Starts or stops profiling.
s_bool | IsProfiling () const
| Checks if the manager is currently profiling.
s_ptr< Profiler > | GetProfiler (const s_uint &iGroup, const s_str &sName, const s_bool &bRecord)
| Creates a profiler with the given parameters.
void | Print (const s_uint &iGroup=s_uint::INF)
| Prints in the log all timing infos.

## Static Public Attributes

static const s_str | CLASS_NAME = "TimeManager"

## Protected Member Functions

| TimeManager ()
| Default constructor.
| ~TimeManager ()
| Destructor.
| TimeManager (const TimeManager &mMgr)
| Copy constructor.
TimeManager & | operator= (const TimeManager &mMgr)
| Assignment operator.

## Private Attributes

GetTimeFunction | pGetTimeFunction_
s_refptr< Timer > | pFPSTimer_
s_bool | bProfiled_
s_bool | bProfiling_
s_uint | uiFPS_
s_double | dDelta_
s_uint | uiFrameNbr_
s_uint | uiAvgFPS_
s_uint | uiBestFPS_
s_uint | uiWorstFPS_
s_double | dStart_
s_double | dLastTime_
s_double | dCurTime_
s_double | dLast_
s_double | dProfileTime_
s_map< s_str, Profiler > | lProfilerList_

## Friends

class | Manager< TimeManager >

## Detailed Description

Keeper of time :).

This class manages everything that is related to time : FPS, date and profiling.

Definition at line 30 of file frost_utils_timemanager.h.

## Member Typedef Documentation

typedef s_double(* Frost::TimeManager::GetTimeFunction)()

Definition at line 35 of file frost_utils_timemanager.h.

## Constructor & Destructor Documentation

Frost::TimeManager::TimeManager | ( |  | ) | `[protected]`

Default constructor.

Note:
  This is a singleton class. That means that there can only be a single instance at the same time. That's why the constructor is not in public scope.
  If you need to get a pointer to that unique instance, call TimeManager::GetSingleton().
  Note that, if GetSingleton() has been called at least once, you'll have to delete the returned pointer when you close your program by calling TimeManager::Delete() (this is automatically done by Engine).

Definition at line 30 of file frost_utils_timemanager.cpp.

Frost::TimeManager::~TimeManager | ( |  | ) | `[protected]`

Destructor.

Note:
  If GetSingleton() has been called at least once, you'll have to delete the returned pointer when you close your program by calling Delete() (this is automatically done by Engine).

Definition at line 37 of file frost_utils_timemanager.cpp.

Frost::TimeManager::TimeManager | ( | const TimeManager & | mMgr | ) | `[protected]`

Copy constructor.

## Member Function Documentation

s_uint Frost::TimeManager::GetAverageFPS | ( |  | ) | const

Returns average frame per second since game launch.

Returns:
  Average frame per second since game launch

Definition at line 111 of file frost_utils_timemanager.cpp.

const s_uint & Frost::TimeManager::GetBestFPS | ( |  | ) | const

Returns the highest Frame Per Second (FPS) count.

Returns:
  Highest number of frame per second over a second

Definition at line 119 of file frost_utils_timemanager.cpp.

s_uint Frost::TimeManager::GetDay | ( |  | ) | const

Returns the current time (day).

Returns:
  The current day number

Definition at line 229 of file frost_utils_timemanager.cpp.

s_uint Frost::TimeManager::GetDayName | ( |  | ) | const

Returns the current time (day name code).

Returns:
  The current day name code

Definition at line 223 of file frost_utils_timemanager.cpp.

s_double Frost::TimeManager::GetDelta | ( |  | ) | const

Returns the time elapsed since last frame.

Returns:
  Elapsed time since last frame

Definition at line 93 of file frost_utils_timemanager.cpp.

const s_uint & Frost::TimeManager::GetFPS | ( |  | ) | const

Returns the current Frame Per Second (FPS) count.

Returns:
  Average number of frame per second over a second

Definition at line 106 of file frost_utils_timemanager.cpp.

s_uint Frost::TimeManager::GetHour | ( |  | ) | const

Returns the current time (hours).

Returns:
  The current hour

Definition at line 235 of file frost_utils_timemanager.cpp.

s_uint Frost::TimeManager::GetMicroseconds | ( |  | ) | const

Returns the current time (microseconds).

Returns:
  The current microseconds

Note:
  On windows, this function only has milisecond resolution.

Definition at line 253 of file frost_utils_timemanager.cpp.

s_uint Frost::TimeManager::GetMinutes | ( |  | ) | const

Returns the current time (minutes).

Returns:
  The current minutes

Definition at line 241 of file frost_utils_timemanager.cpp.

s_uint Frost::TimeManager::GetMonth | ( |  | ) | const

Returns the current time (month).

Returns:
  The current month

Definition at line 217 of file frost_utils_timemanager.cpp.

s_str Frost::TimeManager::GetPlayTime | ( |  | ) | const

Returns the time elapsed since game's start.

Returns:
  The elapsed time since the game has started, formated : "[h.:m.:s.:ms.]"

Definition at line 137 of file frost_utils_timemanager.cpp.

s_ptr< Profiler > Frost::TimeManager::GetProfiler | ( | const s_uint & | iGroup,
|  | const s_str & | sName,
|  | const s_bool & | bRecord |
| ) |  |  |

Creates a profiler with the given parameters.

Parameters:

  | iGroup | The group to which it belongs (used to group prints later)
  | sName | The name of this Profiler (usualy the name of the function it profiles)
  | bRecord | Store all timings in a list to print them later

Note:
  If this profiler already exists, this function returns a pointer to it.

Definition at line 157 of file frost_utils_timemanager.cpp.

s_uint Frost::TimeManager::GetSeconds | ( |  | ) | const

Returns the current time (seconds).

Returns:
  The current seconds

Definition at line 247 of file frost_utils_timemanager.cpp.

s_double Frost::TimeManager::GetTime | ( |  | ) | const

Returns the current time in seconds.

Returns:
  Current time (origin : game's start)

Definition at line 129 of file frost_utils_timemanager.cpp.

const s_uint & Frost::TimeManager::GetWorstFPS | ( |  | ) | const

Returns the lowest Frame Per Second (FPS) count.

Returns:
  Lowest number of frame per second over a second

Definition at line 124 of file frost_utils_timemanager.cpp.

s_uint Frost::TimeManager::GetYear | ( |  | ) | const

Returns the current time (year).

Returns:
  The current year

Definition at line 211 of file frost_utils_timemanager.cpp.

void Frost::TimeManager::Initialize | ( |  | ) |

Initializes this manager.

Note:
  Should be called just before entering the main loop.

Definition at line 46 of file frost_utils_timemanager.cpp.

s_bool Frost::TimeManager::IsProfiling | ( |  | ) | const

Checks if the manager is currently profiling.

Returns:
  'true' if it is profiling

TimeManager& Frost::TimeManager::operator= | ( | const TimeManager & | mMgr | ) | `[protected]`

Assignment operator.

void Frost::TimeManager::Print | ( | const s_uint & | iGroup = `s_uint::INF` | ) |

Prints in the log all timing infos.

Parameters:

  | iGroup | Filter output by group number

Definition at line 185 of file frost_utils_timemanager.cpp.

void Frost::TimeManager::SetGetTimeFunction | ( | GetTimeFunction | pFunc | ) |

Sets the timing function to use.

Parameters:

  | pFunc | The get time function

Note:
  This function will be used by GetTime().
  Its signature must be :
  &nsbp&nsbp&nsbps_double Func();
  and it must return time in seconds.

Definition at line 41 of file frost_utils_timemanager.cpp.

void Frost::TimeManager::SetProfiling | ( | const s_bool & | bProfiling | ) |

Starts or stops profiling.

Parameters:

  | bProfiling | Starts profiling

Definition at line 174 of file frost_utils_timemanager.cpp.

void Frost::TimeManager::Update | ( |  | ) |

Updates delta time and FPS.

Definition at line 60 of file frost_utils_timemanager.cpp.

## Friends And Related Function Documentation

friend class Manager< TimeManager >`[friend]`

Definition at line 32 of file frost_utils_timemanager.h.

## Member Data Documentation

s_bool Frost::TimeManager::bProfiled_`[private]`

Definition at line 194 of file frost_utils_timemanager.h.

s_bool Frost::TimeManager::bProfiling_`[private]`

Definition at line 195 of file frost_utils_timemanager.h.

const s_str Frost::TimeManager::CLASS_NAME = "TimeManager"`[static]`

Definition at line 157 of file frost_utils_timemanager.h.

s_double Frost::TimeManager::dCurTime_`[private]`

Definition at line 208 of file frost_utils_timemanager.h.

s_double Frost::TimeManager::dDelta_`[private]`

Definition at line 198 of file frost_utils_timemanager.h.

s_double Frost::TimeManager::dLast_`[private]`

Definition at line 210 of file frost_utils_timemanager.h.

s_double Frost::TimeManager::dLastTime_`[private]`

Definition at line 207 of file frost_utils_timemanager.h.

s_double Frost::TimeManager::dProfileTime_`[private]`

Definition at line 211 of file frost_utils_timemanager.h.

s_double Frost::TimeManager::dStart_`[private]`

Definition at line 205 of file frost_utils_timemanager.h.

s_map<s_str, Profiler> Frost::TimeManager::lProfilerList_`[private]`

Definition at line 213 of file frost_utils_timemanager.h.

s_refptr<Timer> Frost::TimeManager::pFPSTimer_`[private]`

Definition at line 192 of file frost_utils_timemanager.h.

GetTimeFunction Frost::TimeManager::pGetTimeFunction_`[private]`

Definition at line 190 of file frost_utils_timemanager.h.

s_uint Frost::TimeManager::uiAvgFPS_`[private]`

Definition at line 201 of file frost_utils_timemanager.h.

s_uint Frost::TimeManager::uiBestFPS_`[private]`

Definition at line 202 of file frost_utils_timemanager.h.

s_uint Frost::TimeManager::uiFPS_`[private]`

Definition at line 197 of file frost_utils_timemanager.h.

s_uint Frost::TimeManager::uiFrameNbr_`[private]`

Definition at line 200 of file frost_utils_timemanager.h.

s_uint Frost::TimeManager::uiWorstFPS_`[private]`

Definition at line 203 of file frost_utils_timemanager.h.

The documentation for this class was generated from the following files:

- D:/Programmation/Sources/Tensor2/Utils/include/frost_utils_timemanager.h
- D:/Programmation/Sources/Tensor2/Utils/src/frost_utils_timemanager.cpp