Intuitive timer for Python.
Project description
timer.py
Installation
pip install timerpy
Usage
from time import sleep
from timerpy import Timer
timer = Timer('Some Title')
timer.start()
# Or:
# timer = Timer('Some Title', start=True)
# Some one second process
sleep(1)
# Printing the elapsed time. The timer will continue to run.
timer.elapsed()
# Output:
# [Some Title] 00:00:01.004
# Pause the timer
timer.pause()
# Process that won't be counted
sleep(1)
# Resume the timer
timer.resume()
# Another one second process
sleep(1)
# Overriding the tag
timer.elapsed('Checkpoint 1')
# Output:
# [Checkpoint 1] 00:00:02.013
# Storing the elapsed time to a variable while hiding the output
elapsed = timer.elapsed(print=False)
print(elapsed)
# Output:
# 2.0134578000000003
# Stop the timer
timer.stop('Timer stopped')
# Output:
# [Timer stopped] 00:00:02.013
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timer.py-1.3.0.tar.gz
(2.9 kB
view hashes)
Built Distribution
timer.py-1.3.0-py3-none-any.whl
(16.1 kB
view hashes)