ezEngine  Milestone 9
ezTime Struct Reference

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

#include <Time.h>

Public Member Functions

 EZ_DECLARE_POD_TYPE ()
 
EZ_ALWAYS_INLINE constexpr ezTime ()
 The default constructor sets the time to zero.
 
void SetZero ()
 Sets the time value to zero.
 
EZ_ALWAYS_INLINE constexpr bool IsZero () const
 Returns true if the stored time is exactly zero. That typically means the value was not changed from the default.
 
EZ_ALWAYS_INLINE constexpr bool IsNegative () const
 Checks for a negative time value.
 
EZ_ALWAYS_INLINE constexpr bool IsPositive () const
 Checks for a positive time value. This does not include zero.
 
EZ_ALWAYS_INLINE constexpr bool IsZeroOrNegative () const
 Returns true if the stored time is zero or negative.
 
EZ_ALWAYS_INLINE constexpr bool IsZeroOrPositive () const
 Returns true if the stored time is zero or positive.
 
constexpr float AsFloatInSeconds () const
 Returns the time as a float value (in seconds). More...
 
constexpr double GetNanoseconds () const
 Returns the nanoseconds value.
 
constexpr double GetMicroseconds () const
 Returns the microseconds value.
 
constexpr double GetMilliseconds () const
 Returns the milliseconds value.
 
constexpr double GetSeconds () const
 Returns the seconds value.
 
constexpr double GetMinutes () const
 Returns the minutes value.
 
constexpr double GetHours () const
 Returns the hours 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.
 
constexpr ezTime operator- (const ezTime &other) const
 Returns the difference: "this instance - other".
 
constexpr ezTime operator+ (const ezTime &other) const
 Returns the sum: "this instance + other".
 
constexpr ezTime operator- () const
 
constexpr bool operator< (const ezTime &rhs) const
 
constexpr bool operator<= (const ezTime &rhs) const
 
constexpr bool operator> (const ezTime &rhs) const
 
constexpr bool operator>= (const ezTime &rhs) const
 
constexpr bool operator== (const ezTime &rhs) const
 
constexpr bool operator!= (const ezTime &rhs) const
 

Static Public Member Functions

static ezTime Now ()
 Gets the current time.
 
EZ_ALWAYS_INLINE static constexpr ezTime Nanoseconds (double fNanoseconds)
 Creates an instance of ezTime that was initialized from nanoseconds.
 
EZ_ALWAYS_INLINE static constexpr ezTime Microseconds (double fMicroseconds)
 Creates an instance of ezTime that was initialized from microseconds.
 
EZ_ALWAYS_INLINE static constexpr ezTime Milliseconds (double fMilliseconds)
 Creates an instance of ezTime that was initialized from milliseconds.
 
EZ_ALWAYS_INLINE static constexpr ezTime Seconds (double fSeconds)
 Creates an instance of ezTime that was initialized from seconds.
 
EZ_ALWAYS_INLINE static constexpr ezTime Minutes (double fMinutes)
 Creates an instance of ezTime that was initialized from minutes.
 
EZ_ALWAYS_INLINE static constexpr ezTime Hours (double fHours)
 Creates an instance of ezTime that was initialized from hours.
 
EZ_ALWAYS_INLINE static constexpr ezTime Zero ()
 Creates an instance of ezTime that was initialized with zero.
 

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

◆ AsFloatInSeconds()

constexpr EZ_ALWAYS_INLINE float ezTime::AsFloatInSeconds ( ) 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 struct was generated from the following files: