TimeValue Class Reference Math Library

#include <timevalue.h>

Inheritance diagram for TimeValue:

详细描述

The TimeValue class encapsulates a timer value.

Classes

class   CurrentTime

公共成员函数

  TimeValue ()
  TimeValue ( CurrentTime )
  TimeValue ( ENUM_DONT_INITIALIZE v)
  TimeValue (const TimeValue & src )
  TimeValue ( Int frame, Float64 frameRate)
TimeValue operator= (const TimeValue & src )
Bool   operator== (const TimeValue &b) const
Bool   operator< (const TimeValue &b) const
TimeValue   operator+ (const TimeValue &b) const
TimeValue operator+= (const TimeValue &b)
TimeValue   operator- (const TimeValue &b) const
const TimeValue operator-= (const TimeValue &b)
TimeValue operator*= (const Float64 b)
Float64   GetHours () const
void  SetHours ( Float64 hours)
Float64   GetMinutes () const
void  SetMinutes ( Float64 minutes)
Float64   GetSeconds () const
void  SetSeconds ( Float64 seconds)
Float64   GetMilliseconds () const
void  SetMilliseconds ( Float64 milliseconds)
Float64   GetMicroseconds () const
void  SetMicroseconds ( Float64 microseconds)
Float64   GetNanoseconds () const
void  SetNanoseconds ( Float64 nanoseconds)
const TimeValue Stop ()
String   ToString (const FormatStatement *formatStatement=nullptr) const
HashInt   GetHashCode () const
Int   GetFrame ( Float64 frameRate) const
void  Quantize ( Float64 frameRate)
String   TimeToString ( TIMEFORMAT timeFormat= TIMEFORMAT::SECONDS , Float64 frameRate=1) const
Result < void >  TimeFromString (const String &str, TIMEFORMAT timeFormat, Float64 frameRate)

静态公共成员函数

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() [1/6]

TimeValue ( )

Default constructor.

◆  TimeValue() [2/6]

TimeValue ( CurrentTime   )
explicit

Initialize with the current time stamp.

◆  TimeValue() [3/6]

TimeValue ( ENUM_DONT_INITIALIZE   v )
explicit

Don't initialize class (for better speed)

◆  TimeValue() [4/6]

TimeValue ( const TimeValue src )

Default constructor.

◆  TimeValue() [5/6]

TimeValue ( Int   frame ,
Float64   frameRate  
)
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)

◆  TimeValue() [6/6]

TimeValue ( Float64   seconds )
explicit protected

成员函数文档编制

◆  operator=()

TimeValue & operator= ( const TimeValue src )

Assignment operator.

◆  operator==()

Bool operator== ( const TimeValue b ) const

Compares two TimeValues.

◆  operator<()

Bool operator< ( const TimeValue b ) const

Compares two TimeValues.

◆  operator+()

TimeValue operator+ ( const TimeValue b ) const

Adds two TimeValues.

◆  operator+=()

TimeValue & operator+= ( const TimeValue b )

Adds two TimeValues.

◆  operator-()

TimeValue operator- ( const TimeValue b ) const

Subtracts two TimeValues.

◆  operator-=()

const TimeValue & operator-= ( const TimeValue b )

Subtracts two TimeValues.

◆  operator*=()

TimeValue & operator*= ( const Float64   b )

Multiplies a TimeValue with a factor.

参数
[in] b The second factor.
返回
The result of this * b.

◆  GetHours()

Float64 GetHours ( ) const

Get the TimerValue

返回
Time value in hours.

◆  SetHours()

void SetHours ( Float64   hours )

Set the TimeValue

参数
[in] hours Time value in hours.

◆  GetMinutes()

Float64 GetMinutes ( ) const

Get the TimeValue

返回
Time value in minutes.

◆  SetMinutes()

void SetMinutes ( Float64   minutes )

Set the TimeValue

参数
[in] minutes Time value in minutes.

◆  GetSeconds()

Float64 GetSeconds ( ) const

Get the TimeValue

返回
Time value in seconds.

◆  SetSeconds()

void SetSeconds ( Float64   seconds )

Set the TimeValue

参数
[in] seconds time value in seconds

◆  GetMilliseconds()

Float64 GetMilliseconds ( ) const

Get the TimeValue

返回
time value in milliseconds

◆  SetMilliseconds()

void SetMilliseconds ( Float64   milliseconds )

Set the TimeValue

参数
[in] milliseconds time value in milliseconds

◆  GetMicroseconds()

Float64 GetMicroseconds ( ) const

Get the TimeValue

返回
time value in microseconds

◆  SetMicroseconds()

void SetMicroseconds ( Float64   microseconds )

Set the TimeValue

参数
[in] microseconds time value in microseconds

◆  GetNanoseconds()

Float64 GetNanoseconds ( ) const

Get the TimeValue

返回
time value in nanoseconds

◆  SetNanoseconds()

void SetNanoseconds ( Float64   nanoseconds )

Set the TimeValue

参数
[in] nanoseconds time value in nanoseconds

◆  GetTime()

static TimeValue GetTime ( )
static

Returns the current time stamp. You can use this value for benchmarking/profiling. The resolution is much higher than milliseconds.

返回
Current time stamp.

◆  Stop()

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);
返回
Returns the timer difference.

◆  ToString()

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 .
返回
The converted result.

◆  GetHashCode()

HashInt GetHashCode ( ) const

Returns the hash code of this object.

◆  GetFrame()

Int GetFrame ( Float64   frameRate ) const

retrieve frame number for a given frame rate. note that frame numbers are integer and therefore quantized

◆  Quantize()

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

◆  TimeToString()

String TimeToString ( TIMEFORMAT   timeFormat = TIMEFORMAT::SECONDS ,
Float64   frameRate = 1  
) const

转换 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.
返回
The time as a readable string.

◆  TimeFromString()

Result <void> TimeFromString ( const String str ,
TIMEFORMAT   timeFormat ,
Float64   frameRate  
)

转换 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.
返回
OK on success.

◆  DescribeIO()

static Result <void> DescribeIO ( const DataSerializeInterface stream )
static

Describe all elements of this class for I/O operations.

参数
[in] stream The stream that is used to register the class members.
返回
OK on success.

Friends And Related Function Documentation

◆  operator*

TimeValue operator* ( const TimeValue a ,
const Float64 b  
)
friend

Multiplies a TimeValue with a factor.

参数
[in] a The first factor.
[in] b The second factor.
返回
The result of a * b.

◆  operator/ [1/2]

Float64 operator/ ( const TimeValue a ,
const TimeValue b  
)
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).
返回
The result of a / b, the quotient has unit therefore it is returned as Float64.

◆  operator/ [2/2]

TimeValue operator/ ( const TimeValue a ,
const Float64   b  
)
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).
返回
The result of a / b.

Member Data Documentation

◆  NOW

const CurrentTime NOW static

◆  _value

Float64 _value
private
maxon::TimeValue::TimeValue
TimeValue()
Default constructor.
定义: timevalue.h:43
DiagnosticOutput
#define DiagnosticOutput(formatString,...)
定义: debugdiagnostics.h:166
maxon::TimeValue::GetTime
static TimeValue GetTime()