Microsoft DirectX 8.0

COARefTime Class

COARefTime class hierarchy

Converts reference times between seconds and 100-nanosecond units.

Declaration: Ctlutil.h

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.

Member Functions

Public Methods
COARefTimeConstructor method.
Operators
doubleConverts the reference time to a double value.
REFERENCE_TIMERetrieves the reference time as 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 sets this object to the result.
Operator –=Subtracts one reference time from another, and sets this object to the result.
Operator *Multiplies a reference time.
Operator /Divides a reference time.

COARefTime::COARefTime

COARefTime Class

Constructor method.

Syntax

COARefTime(void);

COARefTime(
    CRefTime crt
);

COARefTime(
    REFERENCE_TIME t
);

COARefTime(
    double d
);

Parameters

crt
CRefTime object that specifies the reference time.
t
REFERENCE_TIME value that specifies the reference time in 100-nanosecond units.
d
double value that specifies the reference time in seconds.

Remarks

The reference time defaults to zero.

COARefTime::double

COARefTime Class

Converts the reference time to a double value.

Syntax

operator double();

Return Value

Returns the reference time in seconds.

COARefTime::REFERENCE_TIME

COARefTime Class

Retrieves the reference time as a REFERENCE_TIME value.

Syntax

operator REFERENCE_TIME();

Return Value

Returns the reference time in 100-nanosecond units.

COARefTime::Operator =

COARefTime Class

Assigns a new reference time.

Syntax

COARefTime& operator=(
    const double& rd
);

COARefTime& operator=(
    const REFERENCE_TIME& rt
);

Parameters

rd
Reference to a double value that specifies the new reference time in seconds.
rt
Reference to a REFERENCE_TIME value that specifies the new reference time in 100-nanosecond units.

Return Value

Returns a reference to the object.

COARefTime::Operator ==

COARefTime Class

Tests for equality between two reference times.

Syntax

BOOL operator==(
    const COARefTime& rt
);

Parameters

rt
Reference to the COARefTime object to compare.

Return Value

Returns TRUE if the two objects are equal. Otherwise, returns FALSE.

COARefTime::Operator !=

COARefTime Class

Tests for inequality between two reference times.

Syntax

BOOL operator!=(
    const COARefTime& rt
);

Parameters

rt
Reference to the COARefTime object to compare.

Return Value

Returns TRUE if the two objects are not equal. Otherwise, returns FALSE.

COARefTime::Operator <

COARefTime Class

Tests if one reference time is less than another.

Syntax

BOOL operator < (
    const COARefTime& rt
);

Parameters

rt
Reference to the COARefTime object to compare.

Return Value

Returns TRUE if this object is strictly less than rt. Otherwise, returns FALSE.

COARefTime::Operator >

COARefTime Class

Tests if one reference time is greater than another.

Syntax

BOOL operator > (
    const COARefTime& rt
);

Parameters

rt
Reference to the COARefTime object to compare.

Return Value

Returns TRUE if this object is strictly greater than rt. Otherwise, returns FALSE.

COARefTime::Operator >=

COARefTime Class

Tests if one reference time is less than or equal to another.

Syntax

BOOL operator >= (
    const COARefTime& rt
);

Parameters

rt
Reference to the COARefTime object to compare.

Return Value

Returns TRUE if this object is less than or equal to rt. Otherwise, returns FALSE.

COARefTime::Operator <=

COARefTime Class

Tests if one reference time is greater than or equal to another.

Syntax

BOOL operator <= (
    const COARefTime& rt
);

Parameters

rt
Reference to the COARefTime object to compare.

Return Value

Returns TRUE if this object is greater than or equal to rt. Otherwise, returns FALSE.

COARefTime::Operator +

COARefTime Class

Adds two reference times.

Syntax

COARefTime operator+(
    const COARefTime& rt
);

Parameters

rt
Reference to the COARefTime object to add.

Return Value

Returns a new COARefTime object equal to the sum of the reference times.

COARefTime::Operator –

COARefTime Class

Subtracts one reference time from another.

Syntax

COARefTime operator-(
    const COARefTime& rt
);

Parameters

rt
Reference to the COARefTime object to subtract.

Return Value

Returns a new COARefTime object equal to the difference of the reference times.

COARefTime::Operator +=

COARefTime Class

Adds two reference times, and sets this object to the result.

Syntax

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

Parameters

rt
Reference to the COARefTime object to add.

Return Value

Returns a reference to the object.

COARefTime::Operator –=

COARefTime Class

Subtracts one reference time from another, and sets this object to the result.

Syntax

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

Parameters

rt
Reference to the COARefTime object to subtract.

Return Value

Returns a reference to the object.

COARefTime::Operator *

COARefTime Class

Multiplies a reference time.

Syntax

COARefTime operator*(
    LONG l
);

Parameters

l
Multiplier.

Return Value

Returns a new COARefTime object equal to the product of this object and l.

COARefTime::Operator /

COARefTime Class

Divides a reference time.

Syntax

COARefTime operator/(
    LONG l
    );

Parameters

l
Divisor.

Return Value

Returns a new COARefTime object equal to the quotient of this object and l.