stoppy ⏱
A precise and lightweight stopwatch built on top of perf_counter, which can be used as a replacement for perf_counter that returns absolute time starting from zero.
The stopwatch can optionally be started automatically by calling time(True) instead of start(), which can streamline usage when polling the time repeatedly.
Installation
Install from PyPI via:
pip install stoppy
Usage
Basic usage is as follows:
from time import sleep
from stoppy import Stopwatch
with Stopwatch(start=True) as stopwatch:
sleep(0.1)
stopwatch.stop()
print(stopwatch.time())
stopwatch.reset()
It can also be used as a direct replacement for perf_counter that returns absolute time starting from zero:
from stoppy import Stopwatch
with Stopwatch() as stopwatch:
# Calling `stopwatch.time(True)` is equivalent to calling `perf_counter()`, but starts from exactly zero
print(stopwatch.time(True))
For all usage examples see examples/.
Metadata
Release files for stoppy 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stoppy-1.0.5.tar.gz | 2.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stoppy-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 kB
Release files / stoppy-1.0.5.tar.gz
| Download URL | stoppy-1.0.5.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e113e7f7369c969108cc925d3ed5e247196c1a0f633b35ca6887886d40261a19
|
|
BLAKE2b-256 checksum How to use checksums |
5d9e57e189186bb267dd7c36e68e5a00874879d3569df32361eea0f0cd1c1456
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Darwin/22.3.0
|
Release files / stoppy-1.0.5-py3-none-any.whl
| Download URL | stoppy-1.0.5-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
917b7ddb5c238d095e36570d458cbe1d6655adb1332782d6f90d4c415f3aba28
|
|
BLAKE2b-256 checksum How to use checksums |
d181ee00d9a480bee912db48460e78dcff97e534d007d9174862d44d6c341532
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Darwin/22.3.0
|