CBaseReferenceClock.GetTime method

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The GetTime method retrieves the current reference time. This method implements the IReferenceClock::GetTime method.

Syntax

HRESULT GetTime(
   REFERENCE_TIME *pTime
);

Parameters

pTime

Pointer to a variable that receives the current time, in 100-nanosecond units.

Return value

Returns one of the HRESULT values shown in the following table.

Return code Description
E_POINTER
NULL pointer argument.
S_FALSE
Returned time is the same as the previous value.
S_OK
Success.

Remarks

This method calls the CBaseReferenceClock::GetPrivateTime method to determine the real clock time. If the clock time is strictly greater than the previous value, GetTime uses the clock time and returns S_OK. Otherwise, GetTime uses the previous value and returns S_FALSE. Therefore, the internal clock can run backward for a short period, without causing the reference time to run backward. Instead, the reference time will "stall" at the same value until the internal clock catches up.

Requirements

Requirement Value
Header
Refclock.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CBaseReferenceClock Class