clock_id
Utility functions for clock IDs.
Functions:
-
parse_clock_id–Parses a string in the format produced by
readable_clock_idinto a clock ID. -
readable_clock_id–Convert a clock ID to a human-readable string.
-
readable_clock_type–Return a human-readable clock type for the given clock ID.
parse_clock_id
Parses a string in the format produced by readable_clock_id into a clock ID.
Possible ambiguities: * an interface name ending with @ followed by a valid IPv4 address will be interpreted as a sensor ID
Parameters:
-
string(str) –The string to parse.
Raises:
-
ValueError–If the string could not be parsed into a valid clock ID
Returns:
-
ClockId(ClockId) –The parsed, valid clock ID
-
API Reference
sync_tooling_msgsclock_idreadable_clock_id
readable_clock_id
Convert a clock ID to a human-readable string.
Outputs of this function are canonical and can be parsed back using parse_clock_id. See that function for possible ambiguities.
Examples:
sensor_id:sensor_name@192.168.1.100interface_id:hostname.eth0linux_clock_device_id:hostname.ptp1ptp_clock_id:123456.fffe.123456system_clock_id:hostname.sys
Parameters:
-
clock_id(ClockId) –The clock ID to convert.
Raises:
-
NotImplementedError–If the clock ID type is not supported (e.g. uninitialized IDs)
Returns:
-
str–The human-readable string
-
API Reference
sync_tooling_msgsport_idreadable_port_id