Skip to content

devRMA/python-stopwatch2

Repository files navigation

Social Card of Python Stopwatch 2

This is a fork from python-stopwatch, which adds static typing and a few other things.

PyPi Version PyPi Downloads Python Versions Repo Size MIT Licensed Stars Contributors

Tests Coverage Status

  • 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.

  • MIT

  • Copyright (c) 2021-2022 Jonghwan Hyeon, 2022-present Rafael