timer.py
timer.py provides convenient functions to measure time in Python.
Installation
pip install timer.py
Usage
from time import sleep
from timer_py import Timer
timer = Timer()
timer.start()
# Or:
# timer = Timer(start=True)
# A one-second process
sleep(1)
# Printing the elapsed time. The timer will continue to run.
timer.elapsed()
# Output:
# [timer.py] 00:00:01.001
timer.pause()
# A one-second process that won't be counted while the timer is paused.
sleep(1)
timer.resume()
# Another one-second process.
sleep(1)
# Overriding the tag for one time only (the original tag will still be remembered).
timer.elapsed('Checkpoint 1')
# Output:
# [Checkpoint 1] 00:00:02.002
timer.set_tag('Custom title')
timer.restart()
# Another one-second process.
sleep(1)
# Storing the elapsed time to a variable as a float while hiding the output.
elapsed = timer.elapsed(print=False)
print(elapsed)
# Output:
# 00:00:01.001
timer.stop()
# Output:
# [Custom title] 00:00:01.001
Metadata
Release files for timer.py 2.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| timer.py-2.5.0.tar.gz | 15.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| timer.py-2.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.1 kB
Release files / timer.py-2.5.0.tar.gz
| Download URL | timer.py-2.5.0.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16c957d2e22f239aea0e7f19989749e987df131a1fa6a1522351a6fa5fc79545
|
|
BLAKE2b-256 checksum How to use checksums |
1bc79ad372500161e294791d031139ac1c124ff993190acfec4862449556acf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / timer.py-2.5.0-py3-none-any.whl
| Download URL | timer.py-2.5.0-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d2c6247cdc83914afd2e5d43ebc8493424151d19309ac71b248c9d47ec43bcb
|
|
BLAKE2b-256 checksum How to use checksums |
dc73594d84682e083a6f8c00c1fd7f87e9bf75926cb86472d59c15c649b724c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|