![]() |
ezEngine Release 25.08
|
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 ()=default |
The default constructor sets the time 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). | |
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. | |
EZ_ALWAYS_INLINE static constexpr ezTime | MakeFromNanoseconds (double fNanoseconds) |
Creates an instance of ezTime that was initialized from nanoseconds. | |
EZ_ALWAYS_INLINE static constexpr ezTime | Nanoseconds (double fNanoseconds) |
EZ_ALWAYS_INLINE static constexpr ezTime | MakeFromMicroseconds (double fMicroseconds) |
Creates an instance of ezTime that was initialized from microseconds. | |
EZ_ALWAYS_INLINE static constexpr ezTime | Microseconds (double fMicroseconds) |
EZ_ALWAYS_INLINE static constexpr ezTime | MakeFromMilliseconds (double fMilliseconds) |
Creates an instance of ezTime that was initialized from milliseconds. | |
EZ_ALWAYS_INLINE static constexpr ezTime | Milliseconds (double fMilliseconds) |
EZ_ALWAYS_INLINE static constexpr ezTime | MakeFromSeconds (double fSeconds) |
Creates an instance of ezTime that was initialized from seconds. | |
EZ_ALWAYS_INLINE static constexpr ezTime | Seconds (double fSeconds) |
EZ_ALWAYS_INLINE static constexpr ezTime | MakeFromMinutes (double fMinutes) |
Creates an instance of ezTime that was initialized from minutes. | |
EZ_ALWAYS_INLINE static constexpr ezTime | Minutes (double fMinutes) |
EZ_ALWAYS_INLINE static constexpr ezTime | MakeFromHours (double fHours) |
Creates an instance of ezTime that was initialized from hours. | |
EZ_ALWAYS_INLINE static constexpr ezTime | Hours (double fHours) |
EZ_ALWAYS_INLINE static constexpr 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)