Skip to main content

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for linux-ticker, version 0.0.12
Filename, size File type Python version Upload date Hashes
Filename, size linux_ticker-0.0.12-py2.py3-none-any.whl (4.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size linux_ticker-0.0.12.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page