Open Reality Reference Guide
 
Loading...
Searching...
No Matches
FBTime Class Reference

Time data structure. More...

#include <fbtime.h>

Public Types

enum  ETimeFormats {
  eSMPTE ,
  eFrame ,
  eDefaultFormat
}
 Different time format available. More...
 

Public Member Functions

 FBTime (kLongLong pTime=0)
 
 FBTime (int pHour, int pMinute, int pSecond=0, int pFrame=0, int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault)
 Constructor.
 
FBString GetTimeString (FBTimeMode pMode=kFBTimeModeDefault, ETimeFormats pFormat=eDefaultFormat)
 Get time as a string.
 
void SetTimeString (const char *pTime)
 Set time from string.
 
bool GetTime (int &pHour, int &pMinute, int &pSecond, int &pFrame, int &pField, int &pMilliSecond, FBTimeMode pTimeMode=kFBTimeModeDefault)
 Get time (filling separate values)
 
kLongLong GetMilliSeconds ()
 Get milliseconds for time.
 
void SetMilliSeconds (kLongLong pMilliSeconds)
 Set milliseconds time.
 
kLongLong & Get ()
 Get time value (long)
 
const kLongLong & Get () const
 Get time value (long)
 
void Set (kLongLong pTime)
 Set time value from a long.
 
double GetSecondDouble ()
 Get seconds as double.
 
void SetSecondDouble (double pTime)
 Set seconds from double.
 
void SetTime (int pHour, int pMinute=0, int pSecond=0, int pFrame=0, int pField=0, FBTimeMode pTimeMode=kFBTimeModeDefault)
 Set time (from separate values)
 
bool IsExactlyOnFrame (FBTimeMode pTimeMode=kFBTimeModeDefault)
 Is the time falling exactly on a frame?
 
FBTimeoperator= (const FBTime &pTime)
 Overloaded assignment operators with FBTime objects.
 
FBTimeoperator+= (const FBTime &pTime)
 
FBTimeoperator-= (const FBTime &pTime)
 
FBTimeoperator*= (const FBTime &pTime)
 
FBTimeoperator/= (const FBTime &pTime)
 
FBTimeoperator= (double pConstant)
 Overloaded assignment operators with constants.
 
FBTimeoperator+= (double pConstant)
 
FBTimeoperator-= (double pConstant)
 
FBTimeoperator*= (double pConstant)
 
FBTimeoperator/= (double pConstant)
 
FBTime operator- (const FBTime &pTime)
 Overloaded arithmetic operators with FBTime objects.
 
FBTime operator+ (const FBTime &pTime)
 
FBTime operator/ (const FBTime &pTime)
 
FBTime operator* (const FBTime &pTime)
 
FBTime operator- (double pConstant)
 Overloaded arithmetic operators with constants.
 
FBTime operator+ (double pConstant)
 
FBTime operator/ (double pConstant)
 
FBTime operator* (double pConstant)
 
bool operator== (const FBTime &pTime)
 Overloaded comparison operators.
 
bool operator!= (const FBTime &pTime)
 
bool operator>= (const FBTime &pTime)
 
bool operator<= (const FBTime &pTime)
 
bool operator> (const FBTime &pTime)
 
bool operator< (const FBTime &pTime)
 
kLongLong GetFrame (FBTimeMode pTimeMode=kFBTimeModeDefault)
 Get the frame count.
 
void SetFrame (kLongLong pFrames, FBTimeMode pTimeMode=kFBTimeModeDefault)
 Set time in frame format.
 

Static Public Attributes

static const FBTime Infinity
 Time constant: Infinity, the largest time value.
 
static const FBTime MinusInfinity
 Time constant: Minus Infinity, the lowest negative time value.
 
static const FBTime Zero
 Time constant: Zero.
 
static const FBTime Epsilon
 Time constant: Epsilon, the smallest time increment.
 
static const FBTime OneSecond
 Time constant: One Second.
 
static const FBTime OneMinute
 Time constant: One Minute.
 
static const FBTime OneHour
 Time constant: One Hour.
 

Detailed Description

Time data structure.

Definition at line 87 of file fbtime.h.

Member Enumeration Documentation

◆ ETimeFormats

Different time format available.

Enumerator
eSMPTE 

format as SMPTE

eFrame 

format as numeric frame

eDefaultFormat 

Default Time format.

Definition at line 94 of file fbtime.h.

Constructor & Destructor Documentation

◆ FBTime()

FBTime ( int  pHour,
int  pMinute,
int  pSecond = 0,
int  pFrame = 0,
int  pField = 0,
FBTimeMode  pTimeMode = kFBTimeModeDefault 
)

Constructor.

Parameters
pHourHour value.
pMinuteMinute value.
pSecondSecond value.
pFrameFrame value.
pFieldField value.
pTimeModeTime mode(default=kFBTimeModeDefault).

Member Function Documentation

◆ Get() [1/2]

kLongLong & Get ( )

Get time value (long)

Returns
Time value as long.

◆ Get() [2/2]

const kLongLong & Get ( ) const

Get time value (long)

Returns
Time value as long.

◆ GetFrame()

kLongLong GetFrame ( FBTimeMode  pTimeMode = kFBTimeModeDefault)

Get the frame count.

With this function, it is possible to obtain the cumulative and local frame counts.

Parameters
pTimeModeTime mode to get the constant (default is kFBTimeModeDefault).
Returns
Frames per second constant for the specified time mode.

◆ GetMilliSeconds()

kLongLong GetMilliSeconds ( )

Get milliseconds for time.

Returns
MilliSeconds value.

◆ GetSecondDouble()

double GetSecondDouble ( )

Get seconds as double.

Returns
Seconds in double form.

◆ GetTime()

bool GetTime ( int &  pHour,
int &  pMinute,
int &  pSecond,
int &  pFrame,
int &  pField,
int &  pMilliSecond,
FBTimeMode  pTimeMode = kFBTimeModeDefault 
)

Get time (filling separate values)

Return values
pHourHour value.
pMinuteMinute value.
pSecondSecond value.
pFrameFrame value.
pFieldField value.
pMilliSecondMilliSecond value.
Parameters
pTimeModeTime mode to get time as.
Returns
true if an acceptable TimeMode value was chosen.

◆ GetTimeString()

FBString GetTimeString ( FBTimeMode  pMode = kFBTimeModeDefault,
ETimeFormats  pFormat = eDefaultFormat 
)

Get time as a string.

Parameters
pModeTime mode (default=kFBTimeModeDefault) to use (call FBSystem().GetTransportFps() to the the current UI displayed mode).
pFormatFormat to use for the returned string(default=FBTime::eDefaultFormat).
Returns
String value of time.

◆ IsExactlyOnFrame()

bool IsExactlyOnFrame ( FBTimeMode  pTimeMode = kFBTimeModeDefault)

Is the time falling exactly on a frame?

Parameters
pTimeModeTime mode to get time as.
Returns
True if the time falls exactly on a frame, false otherwise.
# The following Python snippet shows a scenario where calling IsExactlyOnFrame might be useful.
# Frame 1054
myTime = FBTime( 0, 0, 0, 1054 )
# Frame 1054 with a very small offset
myTime2 = FBTime( 0 )
myTime2.Set( myTime.Get() + 10 )
print( "myTime as frame :", myTime.GetFrame() )
print( "myTime as string :", myTime.GetTimeString( FBTimeMode.kFBTimeModeDefault, FBTime.eSMPTE ) )
print( "myTime on exact frame? :", myTime.IsExactlyOnFrame() )
print( "myTime2 as frame :", myTime2.GetFrame() )
print( "myTime2 as string :", myTime2.GetTimeString( FBTimeMode.kFBTimeModeDefault, FBTime.eSMPTE ) )
print( "myTime2 on exact frame? :", myTime2.IsExactlyOnFrame() )
Time data structure.
Definition fbtime.h:88
@ eSMPTE
format as SMPTE
Definition fbtime.h:96
kLongLong GetFrame(FBTimeMode pTimeMode=kFBTimeModeDefault)
Get the frame count.
void Set(kLongLong pTime)
Set time value from a long.
kLongLong & Get()
Get time value (long)
bool IsExactlyOnFrame(FBTimeMode pTimeMode=kFBTimeModeDefault)
Is the time falling exactly on a frame?
FBString GetTimeString(FBTimeMode pMode=kFBTimeModeDefault, ETimeFormats pFormat=eDefaultFormat)
Get time as a string.
FBTimeMode
Different time modes available.
Definition fbtime.h:63
@ kFBTimeModeDefault
Default Time Mode.
Definition fbtime.h:64

◆ operator-() [1/2]

FBTime operator- ( const FBTime pTime)

Overloaded arithmetic operators with FBTime objects.

Parameters
pTimeTime to use in operation.
Returns
Result in FBTime data.

◆ operator-() [2/2]

FBTime operator- ( double  pConstant)

Overloaded arithmetic operators with constants.

Parameters
pConstantDouble constant to add to time.
Returns
Result in FBTime data.

◆ operator=() [1/2]

FBTime & operator= ( const FBTime pTime)

Overloaded assignment operators with FBTime objects.

Parameters
pTimeTime to assign with operator.
Returns
Resulting time from operation.

◆ operator=() [2/2]

FBTime & operator= ( double  pConstant)

Overloaded assignment operators with constants.

Parameters
pConstantTime to assign with operator.
Returns
Resulting time from operation.

◆ operator==()

bool operator== ( const FBTime pTime)

Overloaded comparison operators.

Parameters
pTimeTime to compare with.
Returns
Result of comparison.

◆ Set()

void Set ( kLongLong  pTime)

Set time value from a long.

Parameters
pTimeTime value to set.

◆ SetFrame()

void SetFrame ( kLongLong  pFrames,
FBTimeMode  pTimeMode = kFBTimeModeDefault 
)

Set time in frame format.

Parameters
pFramesThe number of frames.
pTimeModeThe time mode identifier which will dictate the extraction algorithm.

◆ SetMilliSeconds()

void SetMilliSeconds ( kLongLong  pMilliSeconds)

Set milliseconds time.

Parameters
pMilliSecondsMilliSeconds value.

◆ SetSecondDouble()

void SetSecondDouble ( double  pTime)

Set seconds from double.

Parameters
pTimeTime to set seconds from.

◆ SetTime()

void SetTime ( int  pHour,
int  pMinute = 0,
int  pSecond = 0,
int  pFrame = 0,
int  pField = 0,
FBTimeMode  pTimeMode = kFBTimeModeDefault 
)

Set time (from separate values)

Parameters
pHourHour value.
pMinuteMinute value(default=0).
pSecondSecond value(default=0).
pFrameFrame value(default=0).
pFieldField value(default=0).
pTimeModeTime mode to get time as(default=kFBTimeModeDefault).

◆ SetTimeString()

void SetTimeString ( const char *  pTime)

Set time from string.

Parameters
pTimeString to set time from.

Member Data Documentation

◆ Epsilon

const FBTime Epsilon
static

Time constant: Epsilon, the smallest time increment.

Definition at line 292 of file fbtime.h.

◆ Infinity

const FBTime Infinity
static

Time constant: Infinity, the largest time value.

Definition at line 283 of file fbtime.h.

◆ MinusInfinity

const FBTime MinusInfinity
static

Time constant: Minus Infinity, the lowest negative time value.

Definition at line 286 of file fbtime.h.

◆ OneHour

const FBTime OneHour
static

Time constant: One Hour.

Definition at line 301 of file fbtime.h.

◆ OneMinute

const FBTime OneMinute
static

Time constant: One Minute.

Definition at line 298 of file fbtime.h.

◆ OneSecond

const FBTime OneSecond
static

Time constant: One Second.

Definition at line 295 of file fbtime.h.

◆ Zero

const FBTime Zero
static

Time constant: Zero.

Definition at line 289 of file fbtime.h.


The documentation for this class was generated from the following file: