A simple stopwatch for python
Project description
A simple stopwatch for python, small, efficient and no dependencies
Install
Requires Python 3+ since this module depends on time.perf_counter() which does not exist in Python 2.
pip install stopwatch.py
Usage
from stopwatch import Stopwatch
# Argument specifies decimal precision for __str__
# e.g 2 digits = 1.00, 3 digits = 1.000
# Optional, defaults to 2
stopwatch = Stopwatch(2) # Start a stopwatch
# It's just math with time.perf_counter() so there isn't really a task
# running in background
stopwatch.stop() # Stop stopwatch, time freezes
stopwatch.start() # Start it again
stopwatch.reset() # Reset it back to 0
stopwatch.restart() # Reset and start again
stopwatch.running # Wether stopwatch is running
stopwatch.duration # Get the duration (in seconds)
str(stopwatch) # Get a friendly duration string
License
MIT
Credits
Originally written by dirigeants in this file i just looked at it and rewrote it in python, and it felt useful to put it in a module.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stopwatch.py-1.1.0.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for stopwatch.py-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca504fa21b0c580dad8464ef3c8059b05bb6c8e1f2b81339c2b664b1a04b018e |
|
MD5 | 08b9c10358168c78b87324909c3f8139 |
|
BLAKE2b-256 | e71468c0f656eb4f1ca7046dbea49646c1069d81380f44e7e30d81e8821ed6e3 |