## CRefTime Class

This class is used to manage reference times. It shares the same data layout as the REFERENCE_TIME data type, but adds some (nonvirtual) functions that provide simple comparison, conversion, and arithmetic capabilities.

A reference time is a unit of time represented in 100-nanosecond units. This time unit is the same time unit used by the Microsoft® Win32® FILETIME structure, although the two types cannot be interchanged. Note that the time a REFERENCE_TIME represents is not the time elapsed since 1/1/1601. It is either stream time or reference time, depending on the context.

Data Members

Name | Description
m_time | REFERENCE_TIME value of this object.

Member Functions

Name | Description
CRefTime | Constructs a CRefTime object.
GetUnits | Returns the reference time in units of 100 nanoseconds.
Millisecs | Returns the reference time in milliseconds.

Operators

Name | Description
operator (REFERENCE_TIME) | Casts the CRefTime object to a REFERENCE_TIME data type. The result is the m_time value.
operator = | Implements the copy constructor for the CRefTime class.
operator += | Adds two CRefTime objects and makes this object equal to the result.
operator –= | Subtracts one CRefTime object from another CRefTime object and makes this object equal to the result.

###

CRefTime::CRefTime

CRefTime Class

Constructs a CRefTime object.

CRefTime( );
CRefTime(
LONG msecs
);
CRefTime(
REFERENCE_TIME rt
);

##### Parameters

msecs
  CRefTime value in milliseconds.
rt
  CRefTime object to copy.

##### Return Values

No return value.

##### Remarks

When constructed without parameters, the reference time value defaults to zero.

###

CRefTime::GetUnits

CRefTime Class

Returns the reference time in 100-nanosecond units.

LONGLONG GetUnits(void);

##### Return Values

Returns the reference time value.

###

CRefTime::Millisecs

CRefTime Class

Returns the reference time in milliseconds.

LONG Millisecs(void);

##### Return Values

Returns the reference time value.

###

CRefTime::operator (REFERENCE_TIME)

CRefTime Class

Cast operator that allows a CRefTime object to be used in place of a REFERENCE_TIME object.

    operator REFERENCE_TIME() const;

##### Return Values

Returns the value of m_time.

##### Remarks

The following examples show how this cast operator can be used.

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

###

CRefTime::operator =

CRefTime Class

Assigns a new value to the object from an existing value.

CRefTime& operator=(
const CRefTime& rt
);
CRefTime& operator=(
const LONGLONG ll
);

##### Parameters

rt
  Object to copy during the assignment operation.
ll
  LONGLONG reference time value.

##### Return Values

Returns a reference to this object after the operation.

###

CRefTime::operator +=

CRefTime Class

Adds the value of another CRefTime object to this CRefTime object.

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

##### Parameters

rt
  CRefTime object to be added.

##### Return Values

Returns a reference to this object.

###

CRefTime::operator –=

CRefTime Class

Subtracts another CRefTime object from this CRefTime object.

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

##### Parameters

rt
  CRefTime object to be subtracted.

##### Return Values

Returns the result.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.