Skip to main content

simple_timer

A timer module. Makes it easy to track elapsed time.

Installation

Latest stable version on PyPI:

$ pip install simple_timer

Latest stable version on bitbucket:

$ pip install -e hg+http://bitbucket.org/barseghyanartur/timer@stable#egg=simple_timer

Usage example

Required imports.

>>> from simple_timer import Timer

Initialise timer.

>>> timer = Timer()

Print elapsed duration.

>>> print timer.duration
0.16

Print elapsed timedelta.

>>> print timer.timedelta
datetime.timedelta(0, 0, 7)

Stop the timer. Stopping the timer makes the duration and timedelta properties to freeze.

>>> timer.stop()

Print frozen timedelta value.

>>> print timer.timedelta
datetime.timedelta(0, 2, 943660)

Print frozen duration value.

>>> print timer.duration
2.94366

Once stoped, when calling the stop method again unfreezes the timer, calculates the new values and freezes the timer again.

Shortcut for stopping and returning the duration value.

>>> timer.stop_and_return_duration()
143.230978

Shortcut for stopping and returning the timedelta value.

>>> timer.stop_and_return_timedelta()
datetime.timedelta(0, 170, 351115)

License

GPL 2.0/LGPL 2.1

Author

Artur Barseghyan <artur.barseghyan@gmail.com>

Metadata

Release files for simple_timer 0.2

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

Source distribution (sdist)

Source distribution for simple_timer 0.2
File Size Uploaded Provenance Actions
simple_timer-0.2.tar.gz 3.0 kB Without provenance Details for simple_timer-0.2.tar.gz

Release files / simple_timer-0.2.tar.gz

Download URL simple_timer-0.2.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
785e2d6bea269bded6f67b07827a8ea5324688f42a638c67153e113c1e899c7e
BLAKE2b-256 checksum
How to use checksums
900506b9e3247646aa1ff4e5f012c402b0a722a3bbd332d7702a8a64ad7f0535
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for simple_timer 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

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