#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 | |
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 constructor.
|
explicit |
Initialize with the current time stamp.
|
explicit |
Don't initialize class (for better speed)
construct a time from an integer frame number and a frame rate. the frame rate doesn't need to be an integer and can e.g. be FRAMERATE_NTSC (29.97)
MAXON_OPERATOR_INEQUALITY | ( | TimeValue | ) |
Multiplies a TimeValue with a factor.
[in] | b | The second factor. |
Float64 GetHours | ( | ) | const |
Get the TimerValue
void SetMilliseconds | ( | Float64 | milliseconds | ) |
Set the TimeValue
[in] | milliseconds | time value in milliseconds |
void SetMicroseconds | ( | Float64 | microseconds | ) |
Set the TimeValue
[in] | microseconds | time value in microseconds |
void SetNanoseconds | ( | Float64 | nanoseconds | ) |
Set the TimeValue
[in] | nanoseconds | time value in nanoseconds |
|
static |
Returns the current time stamp. You can use this value for benchmarking/profiling. The resolution is much higher than milliseconds.
const TimeValue& Stop | ( | ) |
Gets the current time and subtracts it from the value stored in the TimeValue.
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. |
retrieve frame number for a given frame rate. note that frame numbers are integer and therefore quantized
void Quantize | ( | Float64 | frameRate | ) |
quantize 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 |
Convert 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 | ||
) |
Convert 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 |
Describe all elements of this class for I/O operations.
[in] | stream | The stream that is used to register the class members. |
Multiplies a TimeValue with a factor.
[in] | a | The first factor. |
[in] | b | The second factor. |
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 |