Microsoft DirectX 9.0


The SetTimeFormat method specifies the time format for the object.


HRESULT SetTimeFormat(
    GUID guidTimeFormat,
    MP_TIMEDATA mpTimeData



[in] Time format GUID that specifies the time format.


[in] Value of type MP_TIMEDATA that specifies the unit of measure for the new format.

Return Values

Returns an HRESULT value. Possible values include the following.

Return Code Description
E_DMOTIMESTAMPFORMAT Object does not support this time format.
S_OK Success.


Objects can support more than one time format. Every object must support reference time, in which each unit of time is 100 nanoseconds (ns). Other formats are optional. The application must ensure that time stamps on the input buffers match whatever time format was set using this method.

The meaning of the mpTimeData parameter depends on the value of the guidTimeFormat parameter.

Time Format Meaning of Time Data
GUID_TIME_MUSIC Parts per quarter note.
GUID_TIME_SAMPLES Samples per second.

When you call this method, also call the FlushEnvelope method, to flush any envelopes that were set using the previous time format.

To determine what time formats an object supports, call the IMediaParamInfo::GetSupportedTimeFormat method. To retrieve the current format, call the IMediaParamInfo::GetCurrentTimeFormat method.

See Also