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 py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page