scallop dome pyformex logo

Previous topic

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

Next topic

pyFormex FAQ ‘n TRICKS

[FSF Associate Member]

Valid XHTML 1.0 Transitional

75. timer — A timer class.

Classes defined in module timer

class timer.Timer(start=None)

A class for measuring elapsed time.

A Timer object measures elapsed real time since a specified time, which by default is the time of the creation of the Timer.

Parameters:

  • start: a datetime object. If not specified, the time of the creation of the Timer is used.
reset(start=None)

(Re)Start the timer.

Sets the start time of the timer to the specified value, or to the current time by default.

Parameters:

  • start: a datetime object. If not specified, the current time as returned by datetime.now() is used.
read(reset=False)

Read the timer.

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

If reset=True, the timer is reset to the time of reading.

seconds(reset=False, 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.

If reset=True, the timer is reset at the time of reading.

Functions defined in module timer