Time Function Reference

3DS Max Plug-In SDK

Time Function Reference

See Also: Advanced Topic Intervals, Class Interval.

This section documents the API functions related to time. For an overview of these functions see the Advanced Topics section Time.

Function:

int GetTicksPerFrame();

Remarks:

Returns the number of ticks per frame.

Function:

void SetTicksPerFrame(int ticks);

Remarks:

Sets the number of ticks per frame.

Parameters:

int ticks

The number of ticks per frame.

Function:

int GetFrameRate();

Remarks:

Retrieves the current frame rate used by 3ds max. This is the Frames Per Second (FPS) setting in the Time Configuration dialog.

Return Value:

The current frame rate in frames per second.

Function:

void SetFrameRate(int rate);

Remarks:

Sets the current frame rate used by 3ds max. This is the Frames Per Second (FPS) setting in the Time Configuration dialog. Note: This call is simply another way to adjust the ticks per frame setting.

Parameters:

int rate

The rate in frames per second.

Function:

TimeDisp GetTimeDisplayMode();

Remarks:

Returns the display mode in use for time values.

Return Value:

One of the following values:

DISPTIME_FRAMES

Frame display format.

DISPTIME_SMPTE

SMPTE time code format.

DISPTIME_FRAMETICKS

Frame:Ticks format.

DISPTIME_TIMETICKS

MM:SS:Ticks format.

Function:

void SetTimeDisplayMode(TimeDisp m);

Remarks:

Sets the display mode for time values. When this setting is changed a notification is sent to automatically update any UI controls containing time values (including plug-in custom controls).

Parameters:

TimeDisp m

The time display mode. This may be one of the following values:

DISPTIME_FRAMES

Frame display format.

DISPTIME_SMPTE

SMPTE time code format.

DISPTIME_FRAMETICKS

Frame:Ticks format.

DISPTIME_TIMETICKS

MM:SS:Ticks format.

Function:

void TimeToString(TimeValue t,TSTR &string);

Remarks:

Formats a time value into a string based on the current frame rate, ticks per frame and display mode.

Parameters:

TimeValue t

The time to format.

TSTR &string

The string to store the result.

Function:

void StringToTime(TSTR string,TimeValue &t);

Remarks:

Parses the specified time string using the current time settings (frame rate, ticks per frame, and time format) and converts it to a TimeValue.

Parameters:

TSTR string

The string to convert.

TimeValue &t

The TimeValue to store the result.

The following #defines are useful when working with time (from \MAXSDK\INCLUDE\MAXTYPES.H).

#define TIME_TICKSPERSEC 4800

#define TicksToSec( ticks ) ((float)(ticks)/(float)TIME_TICKSPERSEC)

#define SecToTicks( secs ) ((TimeValue)(secs*TIME_TICKSPERSEC))

#define TicksSecToTime( ticks, secs ) ( (TimeValue)(ticks)+SecToTicks(secs) )

#define TimeToTicksSec( time, ticks, secs ) { (ticks) = (time)%TIME_TICKSPERSEC; (secs) = (time)/TIME_TICKSPERSEC ; }

#define TIME_PosInfinity 0x7fffffff

#define TIME_NegInfinity 0x80000000

typedef int TimeValue;