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.
- TStopwatch ()
- TStopwatch (const TClock & clockForTiming)
Interface Category:
API.
Purpose:
- Default constructor that uses the TSystemClock.
- Clones the clockForTiming and uses the clone for its timing.
Calling Context:
- Called by the stream-in operators and clients wanting to use TSystemClock.
- Called by clients who need a clock other than the TSystemClock.
Parameters:
- Takes no parameters.
- const TClock & clockForTiming -The clone of clockForTiming is used for the TStopwatch's timing.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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:
- const TTime & resetTime =TTime :: kZero -The time to reset the elapsed time to.
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:
- TTime & elapsedTime -elapsedTime is set to the amount of time elapsed.
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:
- TTime & elapsedTime -elapsedTime is set to the amount of time elapsed.
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.