![]() |
ezEngine
Release 25.03
|
The time class encapsulates a double value storing the time in seconds. More...
#include <Time.h>
Public Member Functions | |
EZ_DECLARE_POD_TYPE () | |
constexpr EZ_ALWAYS_INLINE | ezTime ()=default |
The default constructor sets the time to zero. | |
constexpr EZ_ALWAYS_INLINE bool | IsZero () const |
Returns true if the stored time is exactly zero. That typically means the value was not changed from the default. | |
constexpr EZ_ALWAYS_INLINE bool | IsNegative () const |
Checks for a negative time value. | |
constexpr EZ_ALWAYS_INLINE bool | IsPositive () const |
Checks for a positive time value. This does not include zero. | |
constexpr EZ_ALWAYS_INLINE bool | IsZeroOrNegative () const |
Returns true if the stored time is zero or negative. | |
constexpr EZ_ALWAYS_INLINE 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. | |
constexpr void | operator-= (const ezTime &other) |
Subtracts the time value of "other" from this instances value. | |
constexpr void | operator+= (const ezTime &other) |
Adds the time value of "other" to this instances value. | |
constexpr void | operator*= (double fFactor) |
Multiplies the time by the given factor. | |
constexpr void | operator/= (double fFactor) |
Divides the time by the given factor. | |
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. | |
constexpr static EZ_ALWAYS_INLINE ezTime | MakeFromNanoseconds (double fNanoseconds) |
Creates an instance of ezTime that was initialized from nanoseconds. | |
constexpr static EZ_ALWAYS_INLINE ezTime | Nanoseconds (double fNanoseconds) |
constexpr static EZ_ALWAYS_INLINE ezTime | MakeFromMicroseconds (double fMicroseconds) |
Creates an instance of ezTime that was initialized from microseconds. | |
constexpr static EZ_ALWAYS_INLINE ezTime | Microseconds (double fMicroseconds) |
constexpr static EZ_ALWAYS_INLINE ezTime | MakeFromMilliseconds (double fMilliseconds) |
Creates an instance of ezTime that was initialized from milliseconds. | |
constexpr static EZ_ALWAYS_INLINE ezTime | Milliseconds (double fMilliseconds) |
constexpr static EZ_ALWAYS_INLINE ezTime | MakeFromSeconds (double fSeconds) |
Creates an instance of ezTime that was initialized from seconds. | |
constexpr static EZ_ALWAYS_INLINE ezTime | Seconds (double fSeconds) |
constexpr static EZ_ALWAYS_INLINE ezTime | MakeFromMinutes (double fMinutes) |
Creates an instance of ezTime that was initialized from minutes. | |
constexpr static EZ_ALWAYS_INLINE ezTime | Minutes (double fMinutes) |
constexpr static EZ_ALWAYS_INLINE ezTime | MakeFromHours (double fHours) |
Creates an instance of ezTime that was initialized from hours. | |
constexpr static EZ_ALWAYS_INLINE ezTime | Hours (double fHours) |
constexpr static EZ_ALWAYS_INLINE ezTime | MakeZero () |
Creates an instance of ezTime that was initialized with zero. | |
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.
|
constexpr |
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)