#include <timevalue.h>
The TimeValue class encapsulates a timer value.
Classes | |
class | CurrentTime |
Static Public Member Functions | |
static TimeValue | GetTime () |
static Result< void > | DescribeIO (const DataSerializeInterface &stream) |
Static Public Attributes | |
static const CurrentTime | NOW |
Protected Member Functions | |
constexpr | TimeValue (Float64 seconds) |
Private Attributes | |
Float64 | _value |
Friends | |
TimeValue | operator* (const TimeValue &a, const Float64 &b) |
Float64 | operator/ (const TimeValue &a, const TimeValue &b) |
TimeValue | operator/ (const TimeValue &a, const Float64 b) |
TimeValue | ( | ) |
Default constructs with 0.
|
explicit |
Initializes with the current time stamp.
|
explicit |
Don't initializes class (for better speed)
Constructs a time from an integer frame number and a frame rate.
Construct a time from an inverse timer frequency (stampToTime) and an arbitrary time stamp value.
MAXON_OPERATOR_INEQUALITY | ( | TimeValue | ) |
Float64 GetDays | ( | ) | const |
Get the TimerValue
Float64 GetHours | ( | ) | const |
Gets the value in hours.
void SetHours | ( | Float64 | hours | ) |
Sets the TimeValue in hours.
[in] | hours | Time value in hours. |
void SetMinutes | ( | Float64 | minutes | ) |
Sets the TimeValue in minutes.
[in] | minutes | Time value in minutes. |
void SetSeconds | ( | Float64 | seconds | ) |
Sets the TimeValue in seconds.
[in] | seconds | Time value in seconds. |
Float64 GetMilliseconds | ( | ) | const |
Gets the TimeValue in milliseconds.
void SetMilliseconds | ( | Float64 | milliseconds | ) |
Sets the TimeValue in milliseconds.
[in] | milliseconds | Time value in milliseconds. |
Float64 GetMicroseconds | ( | ) | const |
Gets the TimeValue in microseconds.
void SetMicroseconds | ( | Float64 | microseconds | ) |
Sets the TimeValue in microseconds.
[in] | microseconds | Time value in microseconds. |
Float64 GetNanoseconds | ( | ) | const |
Gets the TimeValue in nanoseconds.
void SetNanoseconds | ( | Float64 | nanoseconds | ) |
Sets the TimeValue in nanoseconds.
[in] | nanoseconds | Time value in nanoseconds. |
Gets the TimeValue in hour, minute and second.
|
static |
Returns the current time stamp. You can use this value for benchmarking/profiling. The resolution is much higher than milliseconds.
const TimeValue& Stop | ( | ) |
Substracts the current time, subtracts it from the value stored in the TimeValue and returns this duration.
String ToString | ( | const FormatStatement * | formatStatement = nullptr | ) | const |
Converts the value into a string.
[in] | formatStatement | Nullptr or an additional formatting instruction. See also Formatting Timer values. |
Retrieves the frame number for a given frame rate.
void Quantize | ( | Float64 | frameRate | ) |
Quantizes the time for a given frame rate, so that its frame value is a multiple of the specified frame rate.
String TimeToString | ( | TIMEFORMAT | timeFormat = TIMEFORMAT::SECONDS , |
Float64 | frameRate = 1 |
||
) | const |
Converts TimeValue into String.
[in] | timeFormat | Specifies the display format. In case of TIMEFORMAT::SECONDS the string will contain a floating point number with two digits after the comma. In case of TIMEFORMAT::FRAMES the string will contain an integer frame number or -if the time does not fall on frame boundaries- a floating point number with two digits after the comma. In case of TIMEFORMAT::SMPTE the return will have the format HH:MM:SS:FF. Frames are always integer values. In case of TIMEFORMAT::SMPTE_DROPFRAMES the return will have the format HH;MM;SS;FF. Note the semicolons instead of the colons. Read more about drop frames here. A TimeValue(3600.0) equals a drop frame time code of 01:00:03:18 (3600 * 30 frames take roughly 1 hour and 3.6 seconds to play back at NTSC frame rate). If the passed frame rate does not match FRAMERATE_NTSC or FRAMERATE_FILM_NTSC the result will be as if TIMEFORMAT::SMPTE was passed. |
[in] | frameRate | The used frame rate, does not need to be provided if TIMEFORMAT::SECONDS is set. |
Result<void> TimeFromString | ( | const String & | str, |
TIMEFORMAT | timeFormat, | ||
Float64 | frameRate | ||
) |
Converts String into TimeValue.
[in] | str | The string to be converted. |
[in] | timeFormat | Specifies the format of the passed string. See also TimeValue::ToString. In case of a SMPTE format drop frame or non-drop frame style is determined by this value and both colons or semicolons are allowed. |
[in] | frameRate | The used frame rate, does not need to be provided if TIMEFORMAT::SECONDS is set. |
|
static |
Describes all elements of this class for I/O operations.
[in] | stream | The stream that is used to register the class members. |
Divides two TimeValues and returns the quotient.
[in] | a | The dividend. |
[in] | b | The divisor. If the divisor is 0, the result will be undefined (floating point exception). |
Divides a TimeValues by a scalar and returns the quotient.
[in] | a | The dividend. |
[in] | b | The divisor. If the divisor is 0, the result will be undefined (floating point exception). |
|
static |
|
private |