Skip to main content

diff_timer

This package includes several timers base on Python.

Timer: base on list

HeapTimer: base on heap

WheelTimer: base on Timing Wheel

Explanation

controller: The Object which is used to create different timers

tick: The time interval which is determined by you

tps: tick per second

Installation

pip install diff_timer
pip install --upgrade diff_timer

How to use

1、Instantiation

from diff_timer import Controller
INTERVAL = 5
tps = 50
controller = Controller()
controller.initTimer("WHEEL", INTERVAL, tps)

2、We need a time driver

TIME_GAP = 1 / tps  # 1 / 50 = 0.02
curTick = 0
while True:
    time.sleep(TIME_GAP)
    controller.tick(curTick)
    curTick += 1

3、set timer at any place that you want

from diff_timer import setTimeOut
def test():
    print("this is a test func")

setTimeOut(test, 10, "test_func")

example: test.py

Release files for diff-timer 0.1.4

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

Source distribution (sdist)

Source distribution for diff-timer 0.1.4
File Size Uploaded
diff_timer-0.1.4.tar.gz 9.1 kB Details

Built distribution (wheel)

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

Total release size: 19.8 kB

Release files / diff_timer-0.1.4.tar.gz

Download URL diff_timer-0.1.4.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0f877c2fbcec2537fadaf41cd1712a01cae2fc4f7159340624e8cc47d83896d0
BLAKE2b-256 checksum
How to use checksums
679112c9c192216f878e328e00bd23549740f6fd8a496efabbe68544ffa6f147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / diff_timer-0.1.4-py3-none-any.whl

Download URL diff_timer-0.1.4-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0dc1f31cf962e4764949494c223994456a79e931bc237f0c9cc0f0957f452611
BLAKE2b-256 checksum
How to use checksums
c66025aeb79276b8f2bcd2712506cb468bd5740f0e4d27fafdc2b5aa74247bed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

3 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