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


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)

Uploaded Source

Built Distribution

linux_ticker-0.0.12-py2.py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page