Skip to content

Clock

Clock(*args, **kwargs)

Bases: SoftwareInstrument

A class representing a software clock instrument.

list_timers()

Lists all active timers.

Returns:

Type Description
list[str]

list[str]: List of active timer names.

read_timer(name)

Reads the elapsed time for the given timer.

Parameters:

Name Type Description Default
name str

The name of the timer.

required

Returns:

Name Type Description
float float

Elapsed time in seconds.

start_timer(name)

Starts a timer with the given name.

Parameters:

Name Type Description Default
name str

The name of the timer.

required

time()

Returns the current time in seconds since the clock was initialized.

Returns:

Name Type Description
float float

Current time in seconds.

timestamp_ms()

Returns the current timestamp in milliseconds since the epoch.

Returns:

Name Type Description
int int

Current timestamp in milliseconds.