Class: TStopwatch

Declaration: LowLevelClock.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

None.

Purpose:

A convenience base class representing a stopwatch for timing intervals. This can be used for calculating elapsed times. TStopwatch is always created as stopped at the elapsed time of zero. There is no calibration done for this stop watch. TStopwatch can not be copied or streamed.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TStopwatch::TStopwatch

  1. TStopwatch ()
  2. TStopwatch (const TClock & clockForTiming)

Interface Category:

API.

Purpose:

  1. Default constructor that uses the TSystemClock.
  2. Clones the clockForTiming and uses the clone for its timing.

Calling Context:

  1. Called by the stream-in operators and clients wanting to use TSystemClock.
  2. Called by clients who need a clock other than the TSystemClock.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStopwatch::~TStopwatch

virtual ~ TStopwatch ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStopwatch::Start

void Start ()

Interface Category:

API.

Purpose:

Accumulates time from the current elapsed time.

Calling Context:

Called to start accumulating time.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStopwatch::Stop

void Stop ()

Interface Category:

API.

Purpose:

Stops accumulating time and keeps the current elapsed time until Start or a reset function is called.

Calling Context:

Called directly to stop the watch.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStopwatch::Reset

void Reset (const TTime & resetTime =TTime :: kZero)

Interface Category:

API.

Purpose:

Resets the elapsed time to the passed in resetTime.

Calling Context:

Called directly to reset the elapsed time.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStopwatch::GetElapsedTime

void GetElapsedTime (TTime & elapsedTime)

Interface Category:

API.

Purpose:

Gets the elapsed time.

Calling Context:

Called directly to get the elapsed time.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TStopwatch::GetElapsedTimeAndReset

void GetElapsedTimeAndReset (TTime & elapsedTime)

Interface Category:

API.

Purpose:

Gets the elapsed time and resets the elapsed time to zero with no loss of time.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.