ezEngine  Milestone 7
ezTime Class Reference

The time class encapsulates a double value storing the time in seconds. More...

#include <Time.h>

Public Member Functions

 EZ_DECLARE_POD_TYPE ()
 
 ezTime ()
 The default constructor sets the time to zero.
 
void SetZero ()
 Sets the time value to zero.
 
float AsFloat () const
 Returns the time as a float value (in seconds). More...
 
double GetNanoseconds () const
 Returns the nanoseconds value.
 
double GetMicroseconds () const
 Returns the microseconds value.
 
double GetMilliseconds () const
 Returns the milliseconds value.
 
double GetSeconds () const
 Returns the seconds value.
 
void operator-= (const ezTime &other)
 Subtracts the time value of "other" from this instances value.
 
void operator+= (const ezTime &other)
 Adds the time value of "other" to this instances value.
 
ezTime operator- (const ezTime &other) const
 Returns the difference: "this instance - other".
 
ezTime operator+ (const ezTime &other) const
 Returns the sum: "this instance + other".
 
bool operator< (const ezTime &rhs) const
 
bool operator<= (const ezTime &rhs) const
 
bool operator> (const ezTime &rhs) const
 
bool operator>= (const ezTime &rhs) const
 
bool operator== (const ezTime &rhs) const
 
bool operator!= (const ezTime &rhs) const
 

Static Public Member Functions

static ezTime Now ()
 Gets the current time.
 
static ezTime Nanoseconds (double fNanoseconds)
 Creates an instance of ezTime that was initialized from nanoseconds.
 
static ezTime Microseconds (double fMicroseconds)
 Creates an instance of ezTime that was initialized from microseconds.
 
static ezTime Milliseconds (double fMilliseconds)
 Creates an instance of ezTime that was initialized from milliseconds.
 
static ezTime Seconds (double fSeconds)
 Creates an instance of ezTime that was initialized from seconds.
 

Private Member Functions

 ezTime (double fTime)
 For internal use only.
 
 EZ_MAKE_SUBSYSTEM_STARTUP_FRIEND (Foundation, Time)
 

Static Private Member Functions

static void Initialize ()
 

Private Attributes

double m_fTime
 The time is stored in seconds.
 

Detailed Description

The time class encapsulates a double value storing the time in seconds.

It offers convenient functions to get the time in other units. ezTime is a high-precision time using the OS specific high-precision timing functions and may thus be used for profiling as well as simulation code.

Member Function Documentation

EZ_FORCE_INLINE float ezTime::AsFloat ( ) const

Returns the time as a float value (in seconds).

Useful for simulation time steps etc. Please note that it is not recommended to use the float value for long running time calculations since the precision can deteriorate quickly. (Only use for delta times is recommended)


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