Timer#
Timer(thread=None, decimals=2)
#
Main class to create a Timer instance. If not using the class with a with
statement as context manager, remember that a timer.start()
should always be followed by timer.stop()
later in the code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread | str | None | Option to start new thread. | None |
decimals | int | None | Option to define decimals for output. Minimum | 2 |
Example
Basic usage:
Python | |
---|---|
Or with a with
statement as context manager:
In both cases, the terminal output example is the same:
With custom thread name and decimals:
Python | |
---|---|
Or with a with
statement as context manager:
Python | |
---|---|
As before, the terminal will output the same result in both cases:
start(thread=None, decimals=None)
#
Starts the Timer. Should always be followed by timer.stop()
later in the code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread | str | None | Option to start new thread. | None |
decimals | int | None | Option to define decimals for output. Minimum | None |
Example
Basic usage:
Python | |
---|---|
Terminal output example:
With custom thread name and decimals:
Python | |
---|---|
Terminal output example:
stop(thread=None)
#
Stops the Timer. Should always be called after timer.start()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread | str | None | Option to stop specific thread. | None |
Example
Basic usage:
Python | |
---|---|
Terminal output example:
With custom thread name and decimals:
Python | |
---|---|
Terminal output example: