## CSystemClock Class

The CSystemClock class implements a system clock that provides time information and timing signals to an application. It uses the CBaseReferenceClock base class to provide most of that functionality, adding persistence.

CSystemClock implements the IPersist interface. For more implementation information, see "OLE Programmers Reference (Vol. 1): Structured Storage Overview."

Member Functions

Name | Description
CreateInstance | Creates an instance of a system clock.
CSystemClock | Constructs a CSystemClock object.

Implemented IPersist Methods

Name | Description
GetClassID | Returns the class identifier for this clock (CLSID_SystemClock).

Implemented INonDelegatingUnknown Methods

Name | Description
NonDelegatingQueryInterface | Passes out pointers to IID_IPersist, and calls the base clock for other interface queries.

###

CSystemClock::CreateInstance

CSystemClock Class

Creates a new instance when placed in the factory template table.

static CUnknown * WINAPI CreateInstance(
LPUNKNOWN pUnk,
HRESULT *phr
);

##### Parameters

pUnk
  Pointer to LPUNKNOWN.
phr
  Pointer to an HRESULT value in which to return resulting information.

##### Return Values

Returns a pointer to a new Component Object Model (COM) object.

##### Remarks

This member function is required to create objects using the class factory. It calls the class constructor.

The phr parameter will be modified only if a failure occurs. If it is a failure code on input, construction can be terminated, but in any case the destructor will be called by the creator when the HRESULT error is detected.

###

CSystemClock::CSystemClock

CSystemClock Class

Constructs a CSystemClock object.

CSystemClock(
TCHAR *pName,
LPUNKNOWN pUnk,
HRESULT *phr
);

##### Parameters

pName
  Name of this object (used for debugging only).
pUnk
  Pointer to the controlling IUnknown interface.
phr
  Pointer to the HRESULT value that will be set if an error occurs.

##### Return Values

No return value.

##### Remarks

If phr points to something other than S_OK upon entry, the object will not be constructed. If an error occurs during construction, this variable will be set; otherwise, its contents will not be altered.

###

CSystemClock::GetClassID

CSystemClock Class

Retrieves the class identifier for this clock.

HRESULT GetClassID(
CLSID *pClsID
);

##### Parameters

pClsID
  Pointer to a CLSID structure which is filled with CLSID_SystemClock.

##### Return Values

Returns an HRESULT value.

###

CSystemClock::NonDelegatingQueryInterface

CSystemClock Class

Returns an interface and increments the reference count.

HRESULT NonDelegatingQueryInterface(
REFIID riid,
void ** ppv
);

##### Parameters

riid
  Reference identifier.
ppv
  Pointer to the interface.

##### Return Values

Returns E_POINTER if ppv is invalid. Returns NOERROR if the query is successful or E_NOINTERFACE if it is not.

##### Remarks

This member function implements the INonDelegatingUnknown::NonDelegatingQueryInterface method and passes out references to the IReferenceClock, IPersist, and IUnknown interfaces.

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