Skip to content

self_reported_clock_state

Utility functions for self-reported clock states.

Functions:

clock_state_name

clock_state_name(state: ValueType) -> str

Return the canonical name for the given clock state enum value.

clock_state_value

clock_state_value(name: str) -> ValueType

Return the enum value for the given canonical clock state name.

diagnose_clock_state

diagnose_clock_state(state: ValueType) -> DiagTree

Diagnose a given clock state enum value.

For valid states, the diagnostic tree is of type Ok. For transient states and invalid states, the diagnostic tree is of type Error.

Specifically, the state is only Ok if the clock state is LOCKED and Warning if the clock state is TRACKING. Otherwise, the state is Error.

Parameters:

  • state (ValueType) –

    The clock state enum value to diagnose

Returns:

  • DiagTree

    The diagnostic tree for the given clock state. This is always a tree of type Ok or

  • DiagTree

    Error.