This reference page is linked to from the following overview topics: Softimage 2014.
#include <xsi_time.h>
The CTime class is a utility class for manipulating time.
Creating a time object using the default constructor can be used to get the current time. The CTime class can also be used to convert from one time format to another.
using namespace XSI; // Set time to frame 30 using the default frame rate CTime time( 30 ); // Get time in seconds double secs = time.GetTime( CTime::Seconds );
Public Types |
|
enum | Format { NTSC, PAL, FILM, CUSTOM } |
The time format defines the number of frames
per second. More... |
|
enum | Unit
{ Frames, Hours, Minutes, Seconds, Milliseconds } |
Time units are used to determine how to
interpret the time. More... |
|
Public Member Functions |
|
CTime () | |
CTime (double in_time) | |
CTime (double in_time, Format in_format, double in_customrate=1.0) | |
CTime (double in_time, CTime::Unit in_units, Format in_format, double in_customrate=1.0) | |
CTime (const CTime &in_time) | |
~CTime () | |
double | GetTime (Unit in_units=CTime::Frames) const |
void | PutTime (double in_time, CTime::Unit units=CTime::Frames) |
CTime::Format | GetFormat (void) const |
double | GetFrameRate (void) const |
void | PutFormat (CTime::Format in_format, double in_customrate=1.0) |
CString | GetAsText (void) const |
void | SetAsText (const CString &in_str) |
CTime & | operator= (const CTime &in_time) |
CTime & | operator= (double in_time) |
bool | operator== (const CTime &rhs) const |
bool | operator== (const double rhs) const |
bool | operator!= (const CTime &rhs) const |
bool | operator!= (const double rhs) const |
operator double () const | |
CTime | Round () const |
Static Public Member Functions |
|
static CTime::Format | ConvertFromPlayControlFormat (const long lFormat) |
static LONG | ConvertToPlayControlFormat (const CTime::Format eFormat) |
enum Format |
The time format defines the number of frames per second.
enum Unit |
Time units are used to determine how to interpret the time.
CTime | ( | ) |
Constructs a time object with the current time and current time format specified by the user preferences for the default frame rate in the Time preferences.
CTime | ( | double | in_time | ) |
Constructs a time object with a specified time value in the time format specified by the user preferences for the default frame rate in the Time preferences.
in_time | time value |
Constructs a time object with a specified time value and time format.
in_time | time value in the format units. |
in_format | time format |
in_customrate | frames per seconds for custom frame rate format |
CTime | ( | double | in_time, |
CTime::Unit | in_units, | ||
Format | in_format, | ||
double | in_customrate =
1.0 |
||
) |
Constructs a time object with a specified time value in user defined time units
in_time | time in units specified by in_units |
in_units | units for input time |
in_format | time format |
in_customrate | frames per seconds for custom frame rate format |
~CTime | ( | ) |
Destructor
double GetTime | ( | Unit | in_units =
CTime::Frames |
) | const |
Returns the time in the specified units. By default time is returned in frames.
in_units | One of the CTime::Unit enum values |
void PutTime | ( | double | in_time, |
CTime::Unit | units =
CTime::Frames |
||
) |
Sets the time in the specified units.
in_time | Time to set. By default time is set in frames |
units | One of the CTime::Unit enum values |
CTime::Format GetFormat | ( | void | ) | const |
Returns the time format
double GetFrameRate | ( | void | ) | const |
Returns the frame rate in seconds for the given time format
void PutFormat | ( | CTime::Format | in_format, |
double | in_customrate =
1.0 |
||
) |
Sets the time format.
in_format | One of the CTime::Format enum values |
in_customrate | Frames per second for custom frame rate format |
CString GetAsText | ( | void | ) | const |
Returns the time as a string using SMPTE format. SMPTE, which stands for the Society of Motion Picture and Television Engineers, is a method of displaying time. There are two ways that SMPTE can be displayed, non-drop or drop frame:
0
:00:00:00.0
:00:00;00.Custom frame rate formats are returned as a string representation of the time as a double precision floating point number to 0 decimal places.
void SetAsText | ( | const CString & | in_str | ) |
Sets the time from a string formated using the SMPTE format. SMPTE, which stands for the Society of Motion Picture and Television Engineers, is a method of displaying time. There are two ways that SMPTE can be displayed, non-drop or drop frame:
0
:00:00:00.0
:00:00;00.If the time is specified using a custom format then the time is expected as a double precision floating point number to 0 decimal places.
in_str | Text representation of the time |
CTime& operator= | ( | double | in_time | ) |
bool operator== | ( | const CTime & | rhs | ) | const |
Equality operator (comparison to another CTime object).
rhs | Time object to compare |
bool operator== | ( | const double | rhs | ) | const |
Equality operator (comparison to a CTime::Time value).
rhs | Time value to compare |
bool operator!= | ( | const CTime & | rhs | ) | const |
Inequality operator (comparison to another CTime object).
rhs | Time object to compare |
bool operator!= | ( | const double | rhs | ) | const |
Inequality operator (comparison to a CTime::Time value).
rhs | Time value to compare |
operator double | ( | ) | const |
Cast operator (returns the time in frames).
CTime Round | ( | ) | const |
Return the time rounded with respect to the current time format.
static CTime::Format ConvertFromPlayControlFormat | ( | const long | lFormat | ) | [static] |
Returns the CTime::Format given a playcontrol frame rate format.
static LONG ConvertToPlayControlFormat | ( | const CTime::Format | eFormat | ) | [static] |
Returns the frame rate format id used by playcontrol, time preferences and scene data objects.