Microsoft DirectX 8.0

CRefTime Class

CRefTime class hierarchy

Helper class to manage reference times.

Declaration: Reftime.h

A reference time is a unit of time represented in 100-nanosecond units. This class shares the same data layout as the REFERENCE_TIME data type, but adds some methods and operators that provide comparison, conversion, and arithmetic functions. For more information about reference times, see Time and Clocks in DirectShow.

Public Member Variables
m_timeREFERENCE_TIME value.
Public Methods
CRefTimeConstructor method.
GetUnitsRetrieves the reference time in 100-nanosecond units.
MillisecsConverts the reference time to milliseconds.
Operators
operator REFERENCE_TIME()Casts the object to a REFERENCE_TIME data type.
operator =Assigns a new reference time.
operator +=Adds two reference times.
operator –=Subtracts one reference time from another.

CRefTime.m_time

CRefTime Class

REFERENCE_TIME value.

Syntax

REFERENCE_TIME m_time;

CRefTime::CRefTime

CRefTime Class

Constructor method.

Syntax

CRefTime(void);

CRefTime(
    LONG msecs
);

CRefTime(
    REFERENCE_TIME rt
);

Parameters

msecs
Time in milliseconds.

rt
Time in 100-nanosecond units.

Remarks

The reference time defaults to zero.

CRefTime::GetUnits

CRefTime Class

Retrieves the reference time in 100-nanosecond units.

Syntax

LONGLONG GetUnits(void);

Return Value

Returns the value of m_time.

CRefTime::Millisecs

CRefTime Class

Converts the reference time to milliseconds.

Syntax

LONG Millisecs(void);

Return Value

Returns the reference time in milliseconds.

CRefTime::operator (REFERENCE_TIME)

CRefTime Class

Casts the object to a REFERENCE_TIME data type.

Syntax

operator REFERENCE_TIME() const;

Return Value

Returns the value of m_time.

Remarks

The following example shows how to use this cast operator:

CRefTime cRT(1000);
REFERENCE_TIME rt = (REFERENCE_TIME)cRT;

CRefTime::operator =

CRefTime Class

Assigns a new reference time.

Syntax

CRefTime& operator=(
    const CRefTime& rt
);

CRefTime& operator=(
    const LONGLONG ll
);

Parameters

rt
Reference to a CRefTime object that specifies the new reference time.
ll
New reference time, in 100-nanosecond units.

Return Value

Returns a reference to the object.

CRefTime::operator +=

CRefTime Class

Adds two reference times.

Syntax

CRefTime& operator+=(
    const CRefTime& rt
);

Parameters

rt
Reference to a CRefTime object.

Return Value

Returns a reference to the object.

CRefTime::operator –=

CRefTime Class

Subtracts one reference time from another.

Syntax

CRefTime& operator-=(
    const CRefTime& rt
);

Parameters

rt
Reference to a CRefTime object.

Return Value

Returns a reference to the object.