Simple ticker for use on linux platform with max resolution of 1ms
Project description
Simple ticker for use on linux platform. Maximum tick resolution is 1 millisecond.
Install using pip:
pip install linux-ticker
Simple use shown below:
from linux_ticker import Ticker, RepeatedTicker
def hello(interval):
print(f'hello() woke after {interval[0]}s')
Repeat the ticker every 0.002 seconds for 2 times:
repeated_ticker = RepeatedTicker(interval=0.002, count=2)
repeated_ticker.tickback(hello, args=(repeated_ticker.interval,))
Execute lambda:
repeated_ticker.tickback(lambda x: print(f'lambda woke after {x[0]}s'), args=(repeated_ticker.interval,))
No tickback - only ticks:
repeated_ticker.tickback(None, args=())
Repeat the ticker every 0.01 second
simple_ticker = Ticker(interval=0.01)
try:
while simple_ticker.tick():
print(f'simple ticker woke after {simple_ticker}s')
finally:
simple_ticker.stop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
linux_ticker-0.0.12.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for linux_ticker-0.0.12-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01fa21a790b5b4711705ab2ad5c2aab518ed1fa63fe87babb440d4b388c87259 |
|
MD5 | 1cb2f4fb0af48a444d857c12dd3e910a |
|
BLAKE2b-256 | 7a59fcf4be52e6115e06d951dcd60037801447057566104b389aaea44fc72434 |