Skip to main content

timer.py

timer.py provides convenient functions to measure time in Python.

Installation

pip install timer.py

Usage

from time import sleep
from timer_py import Timer

timer = Timer()
timer.start()
# Or:
# timer = Timer(start=True)

# A one-second process
sleep(1)

# Printing the elapsed time. The timer will continue to run.
timer.elapsed()
# Output:
# [timer.py] 00:00:01.001

timer.pause()

# A one-second process that won't be counted while the timer is paused.
sleep(1)

timer.resume()

# Another one-second process.
sleep(1)

# Overriding the tag for one time only (the original tag will still be remembered).
timer.elapsed('Checkpoint 1')
# Output:
# [Checkpoint 1] 00:00:02.002

timer.set_tag('Custom title')

timer.restart()

# Another one-second process.
sleep(1)

# Storing the elapsed time to a variable as a float while hiding the output.
elapsed = timer.elapsed(print=False)
print(elapsed)
# Output:
# 00:00:01.001

timer.stop()
# Output:
# [Custom title] 00:00:01.001

Metadata

Release files for timer.py 2.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timer.py 2.5.0
File Size Uploaded
timer.py-2.5.0.tar.gz 15.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for timer.py 2.5.0
File Interpreter ABI Platform
timer.py-2.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.1 kB

Release files / timer.py-2.5.0.tar.gz

Download URL timer.py-2.5.0.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
16c957d2e22f239aea0e7f19989749e987df131a1fa6a1522351a6fa5fc79545
BLAKE2b-256 checksum
How to use checksums
1bc79ad372500161e294791d031139ac1c124ff993190acfec4862449556acf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / timer.py-2.5.0-py3-none-any.whl

Download URL timer.py-2.5.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d2c6247cdc83914afd2e5d43ebc8493424151d19309ac71b248c9d47ec43bcb
BLAKE2b-256 checksum
How to use checksums
dc73594d84682e083a6f8c00c1fd7f87e9bf75926cb86472d59c15c649b724c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

2.5.0 This release

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page