![]() |
Plasma Engine
2.0
|
The time class encapsulates a double value storing the time in seconds. More...
#include <Time.h>
Public Member Functions | |
PL_DECLARE_POD_TYPE () | |
PL_ALWAYS_INLINE constexpr | plTime ()=default |
The default constructor sets the time to zero. | |
PL_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. | |
PL_ALWAYS_INLINE constexpr bool | IsNegative () const |
Checks for a negative time value. | |
PL_ALWAYS_INLINE constexpr bool | IsPositive () const |
Checks for a positive time value. This does not include zero. | |
PL_ALWAYS_INLINE constexpr bool | IsZeroOrNegative () const |
Returns true if the stored time is zero or negative. | |
PL_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 plTime &other) |
Subtracts the time value of "other" from this instances value. | |
constexpr void | operator+= (const plTime &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 plTime | operator- (const plTime &other) const |
Returns the difference: "this instance - other". | |
constexpr plTime | operator+ (const plTime &other) const |
Returns the sum: "this instance + other". | |
constexpr plTime | operator- () const |
constexpr bool | operator< (const plTime &rhs) const |
constexpr bool | operator<= (const plTime &rhs) const |
constexpr bool | operator> (const plTime &rhs) const |
constexpr bool | operator>= (const plTime &rhs) const |
constexpr bool | operator== (const plTime &rhs) const |
constexpr bool | operator!= (const plTime &rhs) const |
Static Public Member Functions | |
static plTime | Now () |
Gets the current time. | |
PL_ALWAYS_INLINE static constexpr plTime | MakeFromNanoseconds (double fNanoseconds) |
Creates an instance of plTime that was initialized from nanoseconds. | |
PL_ALWAYS_INLINE static constexpr plTime | Nanoseconds (double fNanoseconds) |
PL_ALWAYS_INLINE static constexpr plTime | MakeFromMicroseconds (double fMicroseconds) |
Creates an instance of plTime that was initialized from microseconds. | |
PL_ALWAYS_INLINE static constexpr plTime | Microseconds (double fMicroseconds) |
PL_ALWAYS_INLINE static constexpr plTime | MakeFromMilliseconds (double fMilliseconds) |
Creates an instance of plTime that was initialized from milliseconds. | |
PL_ALWAYS_INLINE static constexpr plTime | Milliseconds (double fMilliseconds) |
PL_ALWAYS_INLINE static constexpr plTime | MakeFromSeconds (double fSeconds) |
Creates an instance of plTime that was initialized from seconds. | |
PL_ALWAYS_INLINE static constexpr plTime | Seconds (double fSeconds) |
PL_ALWAYS_INLINE static constexpr plTime | MakeFromMinutes (double fMinutes) |
Creates an instance of plTime that was initialized from minutes. | |
PL_ALWAYS_INLINE static constexpr plTime | Minutes (double fMinutes) |
PL_ALWAYS_INLINE static constexpr plTime | MakeFromHours (double fHours) |
Creates an instance of plTime that was initialized from hours. | |
PL_ALWAYS_INLINE static constexpr plTime | Hours (double fHours) |
PL_ALWAYS_INLINE static constexpr plTime | MakeZero () |
Creates an instance of plTime 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. plTime 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)