Skip to main content

EZTimer A simple and intuitive Python timer library for measuring elapsed time with comprehensive pause/resume functionality.

Installation pip install py-eztimer

Quick Start

from eztimer import EZTimer import time

Basic usage

timer = EZTimer() timer.start()

Do some work...

time.sleep(1.5)

print(f"Elapsed time: {timer.get_elapsed_time():.2f} seconds")

Pause/resume functionality

timer.pause() time.sleep(1) # This won't be counted timer.resume() time.sleep(0.5)

print(f"Total time: {timer.get_elapsed_time():.2f} seconds")

Reset and restart

timer.restart()

API Reference

start() Start the timer. If already running, has no effect.

pause() Pause the timer, freezing the current elapsed time.

resume() Resume a paused timer, continuing from where it left off.

get_elapsed_time() -> float Get the total elapsed time in seconds.

reset() Completely reset the timer to zero.

restart() Reset the timer and immediately start counting again.

Examples

Benchmarking Code Execution

from eztimer import EZTimer

timer = EZTimer() timer.start()

Your code to benchmark

result = sum(i*i for i in range(1000000))

elapsed = timer.get_elapsed_time() print(f"Computation took {elapsed:.4f} seconds")

Timing with Pauses

from eztimer import EZTimer import time

timer = EZTimer() timer.start()

First operation

time.sleep(0.5) timer.pause()

User interaction (not timed)

input("Press Enter to continue...")

timer.resume()

Second operation

time.sleep(0.3)

print(f"Active time: {timer.get_elapsed_time():.2f} seconds")

License

MIT

Metadata

Release files for py-eztimer 1.0.1

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

Source distribution (sdist)

Source distribution for py-eztimer 1.0.1
File Size Uploaded
py_eztimer-1.0.1.tar.gz 3.5 kB Details

Built distribution (wheel)

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

Total release size: 7.1 kB

Release files / py_eztimer-1.0.1.tar.gz

Download URL py_eztimer-1.0.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
54f0583ad9ce1078a655e180eb52aa0b8639e2256d0ccde95148da047914af1b
BLAKE2b-256 checksum
How to use checksums
1fd82ff921ad9e7f4ad606cb6700d7b3e66982817e843b12e0f84be9261a39f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / py_eztimer-1.0.1-py3-none-any.whl

Download URL py_eztimer-1.0.1-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
360dc8dbc3d38d7852862b452308080d47a84ae3211cdbed7a97a94fed019aec
BLAKE2b-256 checksum
How to use checksums
0dc492e00b031fbcc2099cb1d7ee56cbe39a9a5084e1b00df0d458d6f60bcef5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

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