# Poco

# class Stopwatch

Library: Foundation
Package: DateTime
Header: Poco/Stopwatch.h

## Description

A simple facility to measure time intervals with microsecond resolution.

Note that Stopwatch is based on the Timestamp class. Therefore, if during a Stopwatch run, the system time is changed, the measured time will not be correct.

## Member Summary

Member Functions: elapsed, elapsedSeconds, reset, resolution, restart, start, stop

## Constructors

### Stopwatch

Stopwatch();

## Destructor

### ~Stopwatch

~Stopwatch();

## Member Functions

### elapsed

Timestamp::TimeDiff elapsed() const;

Returns the elapsed time in microseconds since the stopwatch started.

### elapsedSeconds

int elapsedSeconds() const;

Returns the number of seconds elapsed since the stopwatch started.

### reset

void reset();

Resets the stopwatch.

### resolution

static Timestamp::TimeVal resolution();

Returns the resolution of the stopwatch.

### restart

void restart();

Resets and starts the stopwatch.

### start

void start();

Starts (or restarts) the stopwatch.

### stop

void stop();

Stops or pauses the stopwatch.