stimuli.time.BaseClock🔗

class stimuli.time.BaseClock[source]🔗

Base class for high precision clocks.

If you want to implement a custom clock, you should subclass this class and define the abstract method stimuli.time.BaseClock.get_time_ns() which should return the time elapsed since instantiation in nanoseconds.

Attributes

t0

The time of instantiation of the clock in seconds.

Methods

get_time()

Return the current time in seconds.

get_time_ms()

Return the current time in milliseconds.

get_time_ns()

Return the current time in nanoseconds.

get_time_us()

Return the current time in microseconds.

reset()

Reset the clock to zero.

get_time()[source]🔗

Return the current time in seconds.

Returns:
timefloat

The current time in seconds.

get_time_ms()[source]🔗

Return the current time in milliseconds.

Returns:
timefloat

The current time in milliseconds.

abstract get_time_ns()[source]🔗

Return the current time in nanoseconds.

Returns:
timeint

The current time in nanoseconds.

get_time_us()[source]🔗

Return the current time in microseconds.

Returns:
timefloat

The current time in microseconds.

abstract reset()[source]🔗

Reset the clock to zero.

property t0🔗

The time of instantiation of the clock in seconds.

Type:

float