Timer

class imagepypelines.Timer[source]

Bases: object

Timer which can be used to time processes

_start

start time in seconds since the epoch

Type

float

_last

last time the lap timer was called

Type

float

_countdown

countdown time if set (recalculated with the countdown property)

Type

float

_last_countdown

last countdown time check

Type

float

Example

#we need to do an action for 10 seconds timer = Timer() timer.countdown = 10

while timer.countdown:

do_action() #this action will run for (about) 10 seconds

# maybe we want to record how long a part of our code runs timer.reset()

do_action() print( timer.lap() )

do_action2() print( timer.lap() )

Attributes Summary

countdown

start

Methods Summary

lap()

returns time in seconds since last time the lap was called

lap_ms()

returns time in milliseconds since last time the lap was called

raw_time()

returns the unrounded time in seconds since the timer started

reset()

resets the timer start time

time()

returns the time in seconds since the timer started or since it was last reset

time_ms()

returns the time in milliseonds since the timer started or since it was last reset

Attributes Documentation

countdown
start

Methods Documentation

lap()[source]

returns time in seconds since last time the lap was called

lap_ms()[source]

returns time in milliseconds since last time the lap was called

raw_time()[source]

returns the unrounded time in seconds since the timer started

reset()[source]

resets the timer start time

time()[source]

returns the time in seconds since the timer started or since it was last reset

time_ms()[source]

returns the time in milliseonds since the timer started or since it was last reset