Skip to main content

timed-count

timed-count provides an iterator that delays each iteration by a specified time period. It can be used to repeatedly execute code at a precise frequency.

timed-count is a good replacement for a loop that contains a call to time.sleep. It is precise, does not dependent on the loop execution time, and won't accumulate temporal drift.

Installation

Install from PyPI via:

pip install timed-count

Usage

Basic usage is as follows:

from timed_count import timed_count

for count in timed_count(0.5):
    # Prints at exactly every half a second
    print(count)
TimedCount(index=0, count=0.0, time=0.000, missed=False)
TimedCount(index=1, count=0.5, time=0.500, missed=False)
TimedCount(index=2, count=1.0, time=1.000, missed=False)
...

For all usage examples see examples/.

Metadata

Release files for timed-count 2.0.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 timed-count 2.0.0
File Size Uploaded
timed_count-2.0.0.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for timed-count 2.0.0
File Interpreter ABI Platform
timed_count-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / timed_count-2.0.0.tar.gz

Download URL timed_count-2.0.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d1b563f75413b8dc75dd89d542b9c526c9b20333c47910be10a9573496b390f4
BLAKE2b-256 checksum
How to use checksums
0318758f22a4531303c2475d3ee87d798c32a6b24eda78a23ce090d506c251c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.2 Darwin/22.4.0

Release files / timed_count-2.0.0-py3-none-any.whl

Download URL timed_count-2.0.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01c7217e2c5ec6e38acc7c2e4972bb3b52582013040d4347c2f005f6d82803fe
BLAKE2b-256 checksum
How to use checksums
b28238899bf0b2dc4bbafa1e1ec0defd269a4e8d31afabc020d5a0d1b1a0aaf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.2 Darwin/22.4.0

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.1.1

2 release files

1.1.0

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