Time Slave Component Requirements#

Time Slave Requirements
status: draft
security: NO
safety: QM
tags: requirements, time_slave, time, time_slave
version: 1

Functional Requirements#

Initialization and Lifecycle#

Component Initialization
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall initialize the gPTP engine and IPC publisher, bind to the configured network interface, and attempt to enable hardware timestamping on the network interface during initialization.

Component Shutdown
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall stop message processing threads, close network sockets, and release IPC resources when deinitialized or when a stop signal is received.

Domain Number Filtering
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall filter gPTP messages by domain number (0-127 per IEEE 802.1AS) and process only messages matching the configured domain.

gPTP Protocol Message Processing#

Sync Message Reception
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall receive IEEE 802.1AS Sync messages from the network Grand Master and extract the receive timestamp using hardware timestamping when available, otherwise using software timestamping as a fallback.

Follow_Up Message Processing
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall process IEEE 802.1AS Follow_Up messages, match them to the corresponding Sync message by sequence ID, and extract the precise origin timestamp.

Offset Calculation
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall compute the clock offset as the difference between the local receive timestamp and the Grand Master origin timestamp, accounting for the correction fields from both the Sync and Follow_Up messages per IEEE 802.1AS.

PDelayReq Transmission
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall transmit IEEE 802.1AS PDelayReq messages at the configured interval (configurable, default 1000 milliseconds) and record the transmit timestamp.

Peer Delay Computation
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall compute network peer delay from PDelayResp and PDelayRespFollowUp timestamps using the IEEE 802.1AS peer delay formula: ((t2 - t1) + (t4 - t3c)) / 2, where t3c is the response origin timestamp corrected by the sum of the PDelayResp and PDelayRespFollowUp correction fields.

Clock Synchronization#

PHC Offset Adjustment
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall step-adjust the PTP hardware clock offset when the absolute value of the computed offset exceeds the configured step threshold (configurable, default 1 second).

PHC Frequency Adjustment
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall slew-adjust the PTP hardware clock frequency based on the neighbor rate ratio computed from consecutive Sync/Follow_Up pairs with positive time intervals per IEEE 802.1AS Clause 11.4.1.

Status and Fault Detection#

Synchronization Timeout Detection
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall set the timeout status flag when no Sync/Follow_Up message pair is successfully processed within the configured timeout period (configurable, range 100 milliseconds to 10 seconds).

Time Leap Future Detection
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall set the time leap future flag when the master time increases by more than the configured future leap threshold between consecutive Sync/Follow_Up pairs. The future leap threshold shall be configurable in the range 1 millisecond to 60 seconds, with validation enforced during configuration loading.

Time Leap Past Detection
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall set the time leap past flag when the master time decreases between consecutive Sync/Follow_Up pairs.

Data Publishing#

Time Sync Data Publishing
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall publish synchronized time data (PTP assumed time, offset correction, rate deviation, peer delay, status flags) via the ts_client IPC interface after processing each Sync/Follow_Up message pair.

Publish Interval
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall update the published time snapshot at a fixed interval of 50 milliseconds to provide consistent read latency for VehicleTime clients.

Platform Abstraction#

Linux Platform Support
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall support Linux platforms for Ethernet frame transmission/reception with hardware timestamping and PTP hardware clock control.

QNX Platform Support
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall support QNX 8.0 SDP platforms for Ethernet frame transmission/reception with hardware timestamping and PTP hardware clock control.

Hardware Timestamping
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall attempt to enable hardware timestamping on the network interface during initialization. If the platform does not support hardware timestamping capabilities (detected by ioctl or equivalent platform API failure), The time_slave component shall fall back to software timestamps and log a warning.

Error Handling#

Error Reporting
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall log messages via the score::mw::log interface when initialization fails (error level), network operations fail (error level), protocol errors occur (error level), or hardware timestamping is unavailable (warning level).

Diagnostics and Debugging#

Synchronization Diagnostics
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Functional
version: 1

The time_slave component shall provide optional runtime instrumentation to record gPTP synchronization events (Sync reception, peer delay completion, offset thresholds, time leaps) to a CSV file for debugging and diagnostics when enabled via the GptpEngineOptions diagnostics configuration parameter.

Assumption of Use Requirements#

Network Interface Configuration
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Process
version: 1

The user shall configure a network interface and ensure the interface has an assigned link-layer address and the link is operationally up (IFF_UP and IFF_RUNNING flags set) before starting time_slave.

Single Instance per Interface
status: valid
security: NO
safety: QM
tags: time, time_slave
reqtype: Process
version: 1

The user shall run exactly one time_slave instance per network interface to prevent gPTP protocol conflicts. Multiple instances binding to the same interface will cause raw socket binding failures or multicast group membership conflicts.