This is a fork from python-stopwatch, which adds static typing and a few other things.
- This package requires python 3.7 or higher.
Step 1. Install the library:
poetry add python-stopwatch2
Other platform? ➜ https://stopwatch2.vercel.app/guide/getting-started.html
Step 2. Import the Stopwatch class:
from stopwatch import Stopwatch
Step 3. Create a new Stopwatch object:
sw = Stopwatch()
Step 4. Place your code here:
from time import sleep
sleep(2)
Step 5. Stop the stopwatch:
sw.stop()
Step 6. Get the elapsed time:
print(f'Time elapsed: {sw.elapsed}') # Time elapsed: 2.0031827000002522
# or
print(f'Time elapsed: {sw}') # Time elapsed: 2.00s
You'll find installation instructions and full documentation on https://stopwatch2.vercel.app.
Run the tests with:
poetry run task test
Please see CHANGELOG for detailed changes for each release.
Please see CONTRIBUTING for details.
-
Copyright (c) 2021-2022 Jonghwan Hyeon, 2022-present Rafael