57. timer — A timer class.

A timer class.

class timer.Timer

A class for measuring elapsed time.

Methods

Create and start a timer.

Methods

Timer objects have the following methods:

reset()
Start the timer.
read()

Read the timer.

This returns the elapsed time since the last reset (or the creation of the timer) as a datetime.timedelta object.

seconds(rounded=True)

Return the timer readings in seconds.

The default return value is a rounded integer number of seconds. With rounded == False, a floating point value with granularity of 1 microsecond is returned.

Documentation

Previous topic

56. sendmail — sendmail.py: a simple program to send an email message

Next topic

58. misc — Python equivalents of the functions in lib.misc

This Page