TimeValue Class Reference Math Library
#include <timevalue.h>
The TimeValue class encapsulates a timer value.
Classes |
|
class | CurrentTime |
静态公共成员函数 |
|
static TimeValue | GetTime () |
static Result < void > | DescribeIO (const DataSerializeInterface &stream) |
静态公共属性 |
|
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)
TimeValue | ( | const TimeValue & | src | ) |
Default constructor.
|
explicit |
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)
|
explicit protected |
TimeValue & operator= | ( | const TimeValue & | src | ) |
Assignment operator.
Bool operator== | ( | const TimeValue & | b | ) | const |
Compares two TimeValues.
Bool operator< | ( | const TimeValue & | b | ) | const |
Compares two TimeValues.
TimeValue operator+ | ( | const TimeValue & | b | ) | const |
Adds two TimeValues.
TimeValue & operator+= | ( | const TimeValue & | b | ) |
Adds two TimeValues.
TimeValue operator- | ( | const TimeValue & | b | ) | const |
Subtracts two TimeValues.
const TimeValue & operator-= | ( | const TimeValue & | b | ) |
Subtracts two TimeValues.
TimeValue & operator*= | ( | const Float64 | b | ) |
Multiplies a TimeValue with a factor.
[in] | b | The second factor. |
Float64 GetHours | ( | ) | const |
Get the TimerValue
void SetHours | ( | Float64 | hours | ) |
Set the TimeValue
[in] | hours | Time value in hours. |
Float64 GetMinutes | ( | ) | const |
Get the TimeValue
void SetMinutes | ( | Float64 | minutes | ) |
Set the TimeValue
[in] | minutes | Time value in minutes. |
Float64 GetSeconds | ( | ) | const |
Get the TimeValue
void SetSeconds | ( | Float64 | seconds | ) |
Set the TimeValue
[in] | seconds | time value in seconds |
Float64 GetMilliseconds | ( | ) | const |
Get the TimeValue
void SetMilliseconds | ( | Float64 | milliseconds | ) |
Set the TimeValue
[in] | milliseconds | time value in milliseconds |
Float64 GetMicroseconds | ( | ) | const |
Get the TimeValue
void SetMicroseconds | ( | Float64 | microseconds | ) |
Set the TimeValue
[in] | microseconds | time value in microseconds |
Float64 GetNanoseconds | ( | ) | const |
Get the TimeValue
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 .
TimeValue t1 = TimeValue::GetTime (); ... do anything ... t1.Stop(); DiagnosticOutput ( "Duration: @" , t1);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 . |
HashInt GetHashCode | ( | ) | const |
Returns the hash code of this object.
Int GetFrame | ( | Float64 | frameRate | ) | const |
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 |
[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 | ||
) |
[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. |
|
friend |
Multiplies a TimeValue with a factor.
[in] | a | The first factor. |
[in] | b | The second factor. |
|
friend |
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). |
|
friend |
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). |
|
|
private |