COARefTime class

[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.]

coareftime class hierarchy

The COARefTime class converts reference times between seconds and 100-nanosecond units.

This class converts between reference times that are compatible with Automation and reference times that are compatible with C/C++. Automation-compatible interfaces use double values to represent time in seconds. Other interfaces use 64-bit LONGLONG values to represent time in 100-nanosecond units. The following types are defined for these values:

typedef LONGLONG  REFERENCE_TIME;
typedef double    REFTIME;

Filters can use the COARefTime class to convert between the two formats. This class is derived from the CRefTime class.

Public Methods Description
COARefTime Constructor method.
Operators Description
double Converts the reference time to a double value.
REFERENCE_TIME Casts the object to a REFERENCE_TIME value.
operator = Assigns a new reference time.
operator == Tests for equality between two reference times.
operator != Tests for inequality between two reference times.
operator < Tests if one reference time is less than another.
operator > Tests if one reference time is greater than another.
operator <= Tests if one reference time is less than or equal to another.
operator >= Tests if one reference time is greater than or equal to another.
operator + Adds two reference times.
**operator ** Subtracts one reference time from another.
operator += Adds two reference times, and assigns the result to this object.
operator = Subtracts two reference times, and assigns the result to this object.
operator * Multiplies a reference time by a value.
operator / Divides a reference time by a value.

Requirements

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