FBX C++ API Reference
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FbxTime Class Reference

#include <fbxtime.h>

Class Description

Class to encapsulate time units.

FbxTime can measure time in hour, minute, second, frame, field, residual and also combination of these units. It is recommended to use FbxTime for all time related operations. For example, currently it is used in FbxGlobalSettings, FbxGlobalTimeSettings, FbxCache, all curve filters and all animation-related classes, etc. FbxTime is just used to represent a moment, to represent a period of time, FbxTimeSpan should be used.

See also
FbxTimeSpan
Examples:
Animation/main.cxx, Audio/main.cxx, ExportScene01/main.cxx, ExportScene02/main.cxx, ExportScene03/main.cxx, ExportScene04/main.cxx, ImportScene/DisplayAnimation.cxx, ImportScene/DisplayCache.cxx, ImportScene/DisplayGlobalSettings.cxx, Instances/main.cxx, Pivot/main.cxx, UserProperties/main.cxx, ViewScene/DrawScene.cxx, ViewScene/DrawScene.h, ViewScene/GetPosition.cxx, ViewScene/GetPosition.h, ViewScene/SceneCache.cxx, ViewScene/SceneCache.h, ViewScene/SceneContext.cxx, ViewScene/SceneContext.h, ViewScene/SetCamera.cxx, and ViewScene/SetCamera.h.

Definition at line 44 of file fbxtime.h.

Public Member Functions

 FbxTime (const FbxLongLong pTime=0)
 Long long constructor. More...
 

Static Public Member Functions

static FbxLongLong GetOneFrameValue (EMode pTimeMode=eDefaultMode)
 One frame value for a specified time mode. More...
 

Time Modes and Protocols

enum  EMode {
  eDefaultMode, eFrames120, eFrames100, eFrames60,
  eFrames50, eFrames48, eFrames30, eFrames30Drop,
  eNTSCDropFrame, eNTSCFullFrame, ePAL, eFrames24,
  eFrames1000, eFilmFullFrame, eCustom, eFrames96,
  eFrames72, eFrames59dot94, eModesCount
}
 Time modes. More...
 
enum  EProtocol { eSMPTE, eFrameCount, eDefaultProtocol }
 Time protocols enumaration. More...
 
static void SetGlobalTimeMode (EMode pTimeMode, double pFrameRate=0.0)
 Set default time mode. More...
 
static EMode GetGlobalTimeMode ()
 Get default time mode. More...
 
static void SetGlobalTimeProtocol (EProtocol pTimeProtocol)
 Set default time protocol. More...
 
static EProtocol GetGlobalTimeProtocol ()
 Get default time protocol. More...
 
static double GetFrameRate (EMode pTimeMode)
 Get frame rate associated with time mode, in frames per second. More...
 
static EMode ConvertFrameRateToTimeMode (double pFrameRate, double pPrecision=0.00000001)
 Get time mode associated with frame rate. More...
 

Time Conversion

enum  EElement {
  eHours, eMinutes, eSeconds, eFrames,
  eField, eResidual
}
 
void Set (FbxLongLong pTime)
 Set time in internal format. More...
 
FbxLongLong Get () const
 Get time in internal format. More...
 
void SetMilliSeconds (FbxLongLong pMilliSeconds)
 Set time in milliseconds. More...
 
FbxLongLong GetMilliSeconds () const
 Get time in milliseconds. More...
 
void SetSecondDouble (double pTime)
 Set time in seconds. More...
 
double GetSecondDouble () const
 Get time in seconds. More...
 
void SetTime (int pHour, int pMinute, int pSecond, int pFrame=0, int pField=0, EMode pTimeMode=eDefaultMode)
 Set time in hour/minute/second/frame/field format. More...
 
void SetTime (int pHour, int pMinute, int pSecond, int pFrame, int pField, int pResidual, EMode pTimeMode)
 Set time in hour/minute/second/frame/field/residual format. More...
 
bool GetTime (int &pHour, int &pMinute, int &pSecond, int &pFrame, int &pField, int &pResidual, EMode pTimeMode=eDefaultMode) const
 Get time in hour/minute/second/frame/field/residual format. More...
 
FbxTime GetFramedTime (bool pRound=true) const
 Snaps a time value to the time value associated with the nearest frame. More...
 
void SetFrame (FbxLongLong pFrames, EMode pTimeMode=eDefaultMode)
 Set time in frame format. More...
 
void SetFramePrecise (FbxDouble pFrames, EMode pTimeMode=eDefaultMode)
 Set time in frame format, including fractions. More...
 
int GetHourCount () const
 Get number of hours in time. More...
 
int GetMinuteCount () const
 Get number of minutes in time. More...
 
int GetSecondCount () const
 Get number of seconds in time. More...
 
FbxLongLong GetFrameCount (EMode pTimeMode=eDefaultMode) const
 Get number of frames in time. More...
 
FbxDouble GetFrameCountPrecise (EMode pTimeMode=eDefaultMode) const
 Get precise number of frames in time, including fractions. More...
 
FbxLongLong GetFieldCount (EMode pTimeMode=eDefaultMode) const
 Get number of fields in time. More...
 
int GetResidual (EMode pTimeMode=eDefaultMode) const
 Get residual time exceeding last full field. More...
 
char GetFrameSeparator (EMode pTimeMode=eDefaultMode) const
 Separator char between second and frame. More...
 
char * GetTimeString (char *pTimeString, const FbxUShort &pTimeStringSize, int pInfo=5, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol) const
 Get time in a human readable format. More...
 
FbxString GetTimeString (EElement pStart=eHours, EElement pEnd=eResidual, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol) const
 Get the time in a human readable format. More...
 
bool SetTimeString (const char *pTime, EMode pTimeMode=eDefaultMode, EProtocol pTimeFormat=eDefaultProtocol)
 Set time in a human readable format. More...
 
static bool IsDropFrame (EMode pTimeMode=eDefaultMode)
 Test for Drop Frame mode. More...
 

Time Operators

bool operator== (const FbxTime &pTime) const
 Equality operator. More...
 
bool operator!= (const FbxTime &pTime) const
 Inequality operator. More...
 
bool operator>= (const FbxTime &pTime) const
 Superior or equal to operator. More...
 
bool operator<= (const FbxTime &pTime) const
 Inferior or equal to operator. More...
 
bool operator> (const FbxTime &pTime) const
 Superior to operator. More...
 
bool operator< (const FbxTime &pTime) const
 Inferior to operator. More...
 
FbxTimeoperator= (const FbxTime &pTime)
 Assignment operator. More...
 
FbxTimeoperator+= (const FbxTime &pTime)
 Addition operator. More...
 
FbxTimeoperator-= (const FbxTime &pTime)
 Subtraction operator. More...
 
FbxTime operator+ (const FbxTime &pTime) const
 Addition operator. More...
 
FbxTime operator- (const FbxTime &pTime) const
 Subtraction operator. More...
 
FbxTime operator* (const int Mult) const
 Multiplication operator. More...
 
FbxTime operator/ (const FbxTime &pTime) const
 Division operator. More...
 
FbxTime operator* (const FbxTime &pTime) const
 Multiplication operator. More...
 

Member Enumeration Documentation

◆ EMode

enum EMode

Time modes.

Remarks
EMode eNTSCDropFrame is used for broadcasting operations where clock time must be (almost) in sync with time code. To bring back color NTSC time code with clock time, this mode drops 2 frames per minute except for every 10 minutes (00, 10, 20, 30, 40, 50). 108 frames are dropped per hour. Over 24 hours the error is 2 frames and 1/4 of a frame. A time-code of 01:00:03:18 equals a clock time of 01:00:00:00
EMode eNTSCFullFrame represents a time address and therefore is NOT IN SYNC with clock time. A time code of 01:00:00:00 equals a clock time of 01:00:03:18.
  • eDefaultMode
  • eFrames120 120 frames/s
  • eFrames100 100 frames/s
  • eFrames60 60 frames/s
  • eFrames50 50 frames/s
  • eFrames48 48 frame/s
  • eFrames30 30 frames/s (black and white NTSC)
  • eFrames30Drop 30 frames/s (use when display in frame is selected, equivalent to NTSC drop)
  • eNTSCDropFrame ~29.97 frames/s drop color NTSC
  • eNTSCFullFrame ~29.97 frames/s color NTSC
  • ePAL 25 frames/s PAL/SECAM
  • eFrames24 24 frames/s Film/Cinema
  • eFrames1000 1000 milli/s (use for date time)
  • eFilmFullFrame ~23.976 frames/s
  • eCustom Custom frame rate value
  • eFrames96 96 frames/s
  • eFrames72 72 frames/s
  • eFrames59dot94 ~59.94 frames/s
  • eModesCount Number of time modes
Enumerator
eDefaultMode 
eFrames120 
eFrames100 
eFrames60 
eFrames50 
eFrames48 
eFrames30 
eFrames30Drop 
eNTSCDropFrame 
eNTSCFullFrame 
ePAL 
eFrames24 
eFrames1000 
eFilmFullFrame 
eCustom 
eFrames96 
eFrames72 
eFrames59dot94 
eModesCount 

Definition at line 90 of file fbxtime.h.

◆ EProtocol

enum EProtocol

Time protocols enumaration.

  • eSMPTE SMPTE EProtocol
  • eFrameCount Frame count
  • eDefaultProtocol Default protocol (initialized to eFRAMES)
Enumerator
eSMPTE 
eFrameCount 
eDefaultProtocol 

Definition at line 118 of file fbxtime.h.

◆ EElement

enum EElement
Enumerator
eHours 
eMinutes 
eSeconds 
eFrames 
eField 
eResidual 

Definition at line 325 of file fbxtime.h.

Constructor & Destructor Documentation

◆ FbxTime()

FbxTime ( const FbxLongLong  pTime = 0)
inline

Long long constructor.

Parameters
pTimeInitial value defined as a 64bit integer.

Definition at line 50 of file fbxtime.h.

50 { mTime = pTime; }

Member Function Documentation

◆ SetGlobalTimeMode()

static void SetGlobalTimeMode ( EMode  pTimeMode,
double  pFrameRate = 0.0 
)
static

Set default time mode.

Parameters
pTimeModeTime mode identifier.
pFrameRateCustom framerate, only have effect in case of pTimeMode = FbxTime::eCustom
Remarks
It is meaningless to set default time mode to eDefaultMode.

◆ GetGlobalTimeMode()

static EMode GetGlobalTimeMode ( )
static

Get default time mode.

Returns
Currently set time mode identifier.
Remarks
Default time mode initial value is eFrames30.

◆ SetGlobalTimeProtocol()

static void SetGlobalTimeProtocol ( EProtocol  pTimeProtocol)
static

Set default time protocol.

Parameters
pTimeProtocolTime protocol identifier.
Remarks
It is meaningless to set default time protocol to eDefaultProtocol.

◆ GetGlobalTimeProtocol()

static EProtocol GetGlobalTimeProtocol ( )
static

Get default time protocol.

Returns
Currently set time protocol identifier.
Remarks
Default time protocol initial value is eSMPTE.

◆ GetFrameRate()

static double GetFrameRate ( EMode  pTimeMode)
static

Get frame rate associated with time mode, in frames per second.

Parameters
pTimeModeTime mode identifier.
Returns
Frame rate value.
Examples:
ExportScene03/main.cxx, and ViewScene/SceneContext.cxx.

◆ ConvertFrameRateToTimeMode()

static EMode ConvertFrameRateToTimeMode ( double  pFrameRate,
double  pPrecision = 0.00000001 
)
static

Get time mode associated with frame rate.

Parameters
pFrameRateThe frame rate value.
pPrecisionThe tolerance value.
Returns
The corresponding time mode identifier or eDefaultMode if no time mode associated to the given frame rate is found.

◆ Set()

void Set ( FbxLongLong  pTime)
inline

Set time in internal format.

Parameters
pTimeTime value to set.

Definition at line 167 of file fbxtime.h.

167 { mTime = pTime; }

◆ Get()

FbxLongLong Get ( ) const
inline

Get time in internal format.

Returns
Time value.
Examples:
ExportScene03/main.cxx.

Definition at line 172 of file fbxtime.h.

172 { return mTime; }

◆ SetMilliSeconds()

void SetMilliSeconds ( FbxLongLong  pMilliSeconds)
inline

Set time in milliseconds.

Parameters
pMilliSecondsTime value to set.
Examples:
Audio/main.cxx.

Definition at line 177 of file fbxtime.h.

177 { mTime = pMilliSeconds * FBXSDK_TC_MILLISECOND; }
#define FBXSDK_TC_MILLISECOND
Definition: fbxtimecode.h:26

◆ GetMilliSeconds()

FbxLongLong GetMilliSeconds ( ) const
inline

Get time in milliseconds.

Returns
Time value.

Definition at line 182 of file fbxtime.h.

182 { return mTime / FBXSDK_TC_MILLISECOND; }
#define FBXSDK_TC_MILLISECOND
Definition: fbxtimecode.h:26

◆ SetSecondDouble()

void SetSecondDouble ( double  pTime)

◆ GetSecondDouble()

double GetSecondDouble ( ) const

Get time in seconds.

Returns
Time value.
Examples:
ExportScene03/main.cxx.

◆ SetTime() [1/2]

void SetTime ( int  pHour,
int  pMinute,
int  pSecond,
int  pFrame = 0,
int  pField = 0,
EMode  pTimeMode = eDefaultMode 
)

Set time in hour/minute/second/frame/field format.

Parameters
pHourThe hours value.
pMinuteThe minutes value.
pSecondThe seconds value.
pFrameThe frames values.
pFieldThe field value.
pTimeModeTime mode identifier.
Remarks
Parameters pHour, pMinute, pSecond, pFrame and pField are summed together. For example, it is possible to set the time to 83 seconds in the following ways: SetTime(0,1,23) or SetTime(0,0,83).
Examples:
ExportScene03/main.cxx.

◆ SetTime() [2/2]

void SetTime ( int  pHour,
int  pMinute,
int  pSecond,
int  pFrame,
int  pField,
int  pResidual,
EMode  pTimeMode 
)

Set time in hour/minute/second/frame/field/residual format.

Parameters
pHourThe hours value.
pMinuteThe minutes value.
pSecondThe seconds value.
pFrameThe frames values.
pFieldThe field value.
pResidualThe hundredths of frame value.
pTimeModeTime mode identifier.
Remarks
Parameters pHour, pMinute, pSecond, pFrame, pField and pResidual are summed together, just like above. pResidual represents hundredths of frame, and won't necessarily correspond to an exact internal value.
The time mode can't have a default value, because otherwise SetTime(int, int, int, int, int, int) would be ambiguous. Please specify DEFAULT_MODE.

◆ GetTime()

bool GetTime ( int &  pHour,
int &  pMinute,
int &  pSecond,
int &  pFrame,
int &  pField,
int &  pResidual,
EMode  pTimeMode = eDefaultMode 
) const

Get time in hour/minute/second/frame/field/residual format.

Parameters
pHourThe returned hours value.
pMinuteThe returned minutes value.
pSecondThe returned seconds value.
pFrameThe returned frames values.
pFieldThe returned field value.
pResidualThe returned hundredths of frame value.
pTimeModeThe time mode identifier which will dictate the extraction algorithm.
Returns
true if the pTimeMode parameter is a valid identifier and thus the extraction succeeded. If the function returns false, all the values are set to 0.

◆ GetFramedTime()

FbxTime GetFramedTime ( bool  pRound = true) const

Snaps a time value to the time value associated with the nearest frame.

Parameters
pRoundIf true the return value is rounded to the nearest integer.
Returns
The snapped time value.

◆ SetFrame()

void SetFrame ( FbxLongLong  pFrames,
EMode  pTimeMode = eDefaultMode 
)

Set time in frame format.

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

◆ SetFramePrecise()

void SetFramePrecise ( FbxDouble  pFrames,
EMode  pTimeMode = eDefaultMode 
)

Set time in frame format, including fractions.

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

◆ GetHourCount()

int GetHourCount ( ) const

Get number of hours in time.

Returns
Hours value.

◆ GetMinuteCount()

int GetMinuteCount ( ) const

Get number of minutes in time.

Returns
Minutes value.

◆ GetSecondCount()

int GetSecondCount ( ) const

Get number of seconds in time.

Returns
Seconds value.

◆ GetFrameCount()

FbxLongLong GetFrameCount ( EMode  pTimeMode = eDefaultMode) const

Get number of frames in time.

Parameters
pTimeModeTime mode identifier.
Returns
Integer value representing the frame count.

◆ GetFrameCountPrecise()

FbxDouble GetFrameCountPrecise ( EMode  pTimeMode = eDefaultMode) const

Get precise number of frames in time, including fractions.

Parameters
pTimeModeTime mode identifier.
Returns
Decimal value representing the frame count, including fractions.

◆ GetFieldCount()

FbxLongLong GetFieldCount ( EMode  pTimeMode = eDefaultMode) const

Get number of fields in time.

Parameters
pTimeModeTime mode identifier.
Returns
Fields value.

◆ GetResidual()

int GetResidual ( EMode  pTimeMode = eDefaultMode) const

Get residual time exceeding last full field.

Parameters
pTimeModeTime mode identifier.
Returns
Residual value.

◆ IsDropFrame()

static bool IsDropFrame ( EMode  pTimeMode = eDefaultMode)
static

Test for Drop Frame mode.

Parameters
pTimeModeTime mode identifier.
Returns
True if the pTimeMode is a Drop Frame mode.

◆ GetFrameSeparator()

char GetFrameSeparator ( EMode  pTimeMode = eDefaultMode) const

Separator char between second and frame.

Parameters
pTimeModeTime mode identifier.
Returns
';' is returned if pTimeMode is a DropFrame mode otherwise ':'.

◆ GetTimeString() [1/2]

char* GetTimeString ( char *  pTimeString,
const FbxUShort pTimeStringSize,
int  pInfo = 5,
EMode  pTimeMode = eDefaultMode,
EProtocol  pTimeFormat = eDefaultProtocol 
) const

Get time in a human readable format.

Parameters
pTimeStringAn array large enough to contain a minimum of 19 characters.
pTimeStringSizeSize of the pTimeString buffer used with secure functions.
pInfoThe amount of information if time protocol is eSMPTE:
  • 1 means hours only
  • 2 means hours and minutes
  • 3 means hours, minutes and seconds
  • 4 means hours, minutes, seconds and frames
  • 5 means hours, minutes, seconds, frames and field
  • 6 means hours, minutes, seconds, frames, field and residual value
pTimeModeRequested time mode.
pTimeFormatRequested time protocol.
Returns
pTimeString parameter filled with a time value or set to a empty string if parameter pInfo is not valid.
Examples:
ImportScene/DisplayAnimation.cxx, and ImportScene/DisplayGlobalSettings.cxx.

◆ GetTimeString() [2/2]

FbxString GetTimeString ( EElement  pStart = eHours,
EElement  pEnd = eResidual,
EMode  pTimeMode = eDefaultMode,
EProtocol  pTimeFormat = eDefaultProtocol 
) const

Get the time in a human readable format.

Parameters
pStartThe starting element type used to format the time string.
pEndThe last element type used to format the time string.
pTimeModeThe time mode requested.
pTimeFormatThe time format requested.
Returns
The human readable time string.

◆ SetTimeString()

bool SetTimeString ( const char *  pTime,
EMode  pTimeMode = eDefaultMode,
EProtocol  pTimeFormat = eDefaultProtocol 
)

Set time in a human readable format.

Parameters
pTimeAn array of a maximum of 18 characters. If time protocol is eSMPTE, pTimeString must be formatted this way: "[hours:]minutes[:seconds[.frames[.fields]]]". Hours, minutes, seconds, frames and fields are parsed as integers and brackets indicate optional parts. If time protocol is eFRAME, pTimeString must be formatted this way: "frames". Frames is parsed as a 64 bits integer.
pTimeModeGiven time mode.
pTimeFormatGiven time protocol.
Returns
True if the set time string succeed, otherwise return false.

◆ operator==()

bool operator== ( const FbxTime pTime) const
inline

Equality operator.

Parameters
pTimeThe FbxTime to be compared.
Returns
true if equal, false otherwise.

Definition at line 358 of file fbxtime.h.

358 { return mTime == pTime.mTime; }

◆ operator!=()

bool operator!= ( const FbxTime pTime) const
inline

Inequality operator.

Parameters
pTimeThe FbxTime to be compared.
Returns
true if unequal, false otherwise.

Definition at line 364 of file fbxtime.h.

364 { return mTime != pTime.mTime; }

◆ operator>=()

bool operator>= ( const FbxTime pTime) const
inline

Superior or equal to operator.

Parameters
pTimeThe FbxTime to be compared.
Returns
true if this FbxTime is superior or equal to the passed FbxTime, false otherwise.

Definition at line 370 of file fbxtime.h.

370 { return mTime >= pTime.mTime; }

◆ operator<=()< h2="">
bool operator<= ( const FbxTime pTime) const
inline

Inferior or equal to operator.

Parameters
pTimeThe FbxTime to be compared.
Returns
true if this FbxTime is inferior or equal to the passed FbxTime, false otherwise.

Definition at line 376 of file fbxtime.h.

376 { return mTime <= pTime.mTime; }

◆ operator>()

bool operator> ( const FbxTime pTime) const
inline

Superior to operator.

Parameters
pTimeThe FbxTime to be compared.
Returns
true if this FbxTime is superior to the passed FbxTime, false otherwise.

Definition at line 382 of file fbxtime.h.

382 { return mTime > pTime.mTime; }

◆ operator<()< h2="">
bool operator< ( const FbxTime pTime) const
inline

Inferior to operator.

Parameters
pTimeThe FbxTime to be compared.
Returns
true if this FbxTime is inferior to the passed FbxTime, false otherwise.

Definition at line 388 of file fbxtime.h.

388 { return mTime < pTime.mTime; }

◆ operator=()

FbxTime& operator= ( const FbxTime pTime)
inline

Assignment operator.

Parameters
pTimeThe FbxTime to be assigned.

Definition at line 393 of file fbxtime.h.

393 { mTime = pTime.mTime; return *this; }

◆ operator+=()

FbxTime& operator+= ( const FbxTime pTime)
inline

Addition operator.

Parameters
pTimeThe FbxTime to be added.
Returns
This FbxTime after addition.

Definition at line 399 of file fbxtime.h.

399 { mTime += pTime.mTime; return *this; }

◆ operator-=()

FbxTime& operator-= ( const FbxTime pTime)
inline

Subtraction operator.

Parameters
pTimeThe FbxTime to be subtracted.
Returns
This FbxTime after subtraction.

Definition at line 405 of file fbxtime.h.

405 { mTime -= pTime.mTime; return *this; }

◆ operator+()

FbxTime operator+ ( const FbxTime pTime) const

Addition operator.

Parameters
pTimeThe FbxTime to be added.
Returns
A temporary FbxTime after addition.

◆ operator-()

FbxTime operator- ( const FbxTime pTime) const

Subtraction operator.

Parameters
pTimeThe FbxTime to be subtracted.
Returns
A temporary FbxTime after subtraction.

◆ operator*() [1/2]

FbxTime operator* ( const int  Mult) const

Multiplication operator.

Parameters
MultMultiply this FbxTime by int Mult.
Returns
A temporary FbxTime after multiplication.

◆ operator/()

FbxTime operator/ ( const FbxTime pTime) const

Division operator.

Parameters
pTimeDivide this FbxTime by pTime.
Returns
A temporary FbxTime after division.

◆ operator*() [2/2]

FbxTime operator* ( const FbxTime pTime) const

Multiplication operator.

Parameters
pTimeMultiply this FbxTime by pTime.
Returns
A temporary FbxTime after multiplication.

◆ GetOneFrameValue()

static FbxLongLong GetOneFrameValue ( EMode  pTimeMode = eDefaultMode)
static

One frame value for a specified time mode.

Parameters
pTimeModeTime mode identifier.
Returns
the time code of a one frame.

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