Skip to main content

utils.ticks

ticks_ms

def ticks_ms()

Returns monotonic time in ms.

ticks_fresh

def ticks_fresh(ticks, thresh_ms=1000)

Returns true if age of ticks is less than thresh_ms, assuming within 2**29 ticks of current ticks_ms()

ticks_diff

def ticks_diff(ticks1, ticks2)

TODO: Remove me!

Returns difference between ticks1 and ticks2, assuming within 2**29 ticks of current ticks_ms()

TickRepeater Objects

class TickRepeater()

Used as a timer, with the check() method returning true every ticks_period_ms

reset

def reset()

Reset the timer to start from the current time.

check

def check()

Return True if the period has passed since the last tick.

DtTracker Objects

class DtTracker()

TODO: Remove me!

Used for tracking multiple timeseries, differentiated by name parameter passed to constructor.

age

def age(_ticks_ms)

Returns time in ms from last update() to _ticks_ms.

ticks_age

def ticks_age() -> int

Returns time in ms since last update() Updates the time tracker.

ticks_age_cumul

def ticks_age_cumul() -> int

Returns time in ms since last update() Does NOT update the time tracker.

start

def start(_ticks_ms=None)

Start the time tracker.

stop

def stop(_ticks_ms=None)

Stop the time tracker.

update_history

def update_history(dt_ms)

Addend dt history with dt_ms.

update

def update()

Reset the time tracker.

mean_dt

def mean_dt()

Returns mean of the dt_history.

minmeanmax

def minmeanmax()

Returns string with min, mean, & max of the dt_history.