system_clock

System clock implementation for Pipecat.

class pipecat.clocks.system_clock.SystemClock[source]

Bases: BaseClock

A monotonic clock implementation using system time.

Provides high-precision timing using the system’s monotonic clock, which is not affected by system clock adjustments and is suitable for measuring elapsed time in real-time applications.

__init__()[source]

Initialize the system clock.

The clock starts in an uninitialized state and must be started explicitly using the start() method before time measurement begins.

get_time() int[source]

Get the elapsed time since the clock was started.

Returns:

The elapsed time in nanoseconds since start() was called. Returns 0 if the clock has not been started yet.

start()[source]

Start the clock and begin time measurement.

Records the current monotonic time as the reference point for all subsequent get_time() calls.