Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ docs(
data = [
"@score_process//:needs_json",
],
source_dir = "docs",
source_dir = ".",
)

copyright_checker(
Expand Down
10 changes: 9 additions & 1 deletion docs/conf.py → conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
"score_metrics",
]

include_patterns = [
"index.rst",
"docs/**",
"score/time/docs/**",
"score/time_slave/docs/**",
"score/time_daemon/docs/**",
]

exclude_patterns = [
# The following entries are not required when building the documentation via 'bazel
# build //docs:docs', as that command runs in a sandboxed environment. However, when
Expand All @@ -51,7 +59,7 @@
".venv_docs",
]

templates_path = ["templates"]
templates_path = ["docs/templates"]

# Enable numref
numfig = True
Empty file removed docs/manuals/.gitkeep
Empty file.
21 changes: 21 additions & 0 deletions docs/manuals/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
..
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

Manuals
#######

.. toctree::
:titlesonly:

user_manual
72 changes: 72 additions & 0 deletions docs/manuals/troubleshooting_guide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
..
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

.. _manual_time_troubleshooting:

*********************
Troubleshooting Guide
*********************

This guide provides solutions to common problems encountered when using or integrating the S-CORE ``time`` module.

Clock is Not Reliable or Not Available
======================================

**Symptom:**
Your application calls ``clock.Now()``, but ``snapshot.Status().IsReliable()`` always returns `false`. Or, ``clock.WaitUntilAvailable()`` runs into a timeout.

**Potential Causes and Solutions:**

1. **TimeSlave Not Running or Not Synchronized:**
* **Check:** Is the `time_slave` process running on the ECU?
* **Check:** Is there a PTP Grandmaster Clock active on the network, in the same PTP domain as the `time_slave` (default domain: 0)?
* **Solution:** Ensure the `time_slave` is started correctly and that a PTP master is present and reachable on the specified network interface. Check the logs of the `time_slave` for messages related to master detection.

2. **TimeDaemon Not Running:**
* **Check:** Is the `time_daemon` process running on the ECU? The `time_slave` can run, but if the `time_daemon` isn't there to process the data, client applications will not receive reliable time.
* **Solution:** Ensure the `time_daemon` process is started.

3. **IPC Channel Mismatch:**
* **Check:** The `time_slave` and `time_daemon` communicate via a POSIX shared memory file. By default, this is ``/gptp_ptp_info``.
* **Solution:** Verify that this file exists in the shared memory file system (e.g., under `/dev/shm/` on Linux). Check for permission issues that might prevent one of the processes from accessing the file.

4. **Sync Timeout:**
* **Check:** The `time_slave` has a built-in timeout (`sync_timeout_ms`, default: 3300 ms). If it doesn't receive PTP Sync messages within this period, it declares a timeout.
* **Solution:** Check the network for packet loss. If you are in a simulated environment (QEMU, Docker), ensure the virtual network bridge is configured correctly.

"Permission Denied" on TimeSlave Startup
========================================

**Symptom:**
The `time_slave` process fails to start with an error message similar to "Permission denied", "Operation not permitted", or a socket creation error.

**Cause & Solution:**

Understanding Log Messages
==========================
Comment on lines +54 to +57

The `time` module components use specific logging contexts to identify the source of a message. This can help you pinpoint where a problem is occurring.

.. list-table:: Logging Contexts
:widths: 20 80
:header-rows: 1

* - Context ID
- Description
* - ``[TSAP]``
- **Time Slave Application.** Relates to the main lifecycle (Initialize/Run) of the ``time_slave`` process.
* - ``[GTPS]``
- **GPTP Slave.** Relates to the core gPTP protocol engine within the ``time_slave`` (e.g., parsing PTP messages, state machines).
* - ``[GPTP]``
- **GPTP Machine Adapter.** Relates to the component within the ``time_daemon`` that receives and processes the data from shared memory.
161 changes: 161 additions & 0 deletions docs/manuals/user_manual.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
..
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

.. _user_manual:

User Manual
###########

.. document:: User Manual Time Module
:id: doc__user_manual_time
:status: draft
:version: 1
:safety: QM
:security: NO
:realizes: wp__training_path[version==1]

Overview
========

This user manual provides comprehensive guidance for integrating and deploying the S-CORE ``time`` module from a system integrator perspective.

The S-CORE ``time`` module provides a robust, high-precision time base for applications on an ECU,
synchronized to a network-wide PTP (Precision Time Protocol) Grandmaster Clock. The module consists of three components:

* **Client Library** (``score::time``): C++ API for accessing synchronized time
* **TimeSlave**: System daemon that synchronizes with the PTP Grandmaster over the network
* **TimeDaemon**: System daemon that provides quality-assured time to client applications

This module manual covers module-level integration, deployment, and troubleshooting. For component-specific usage and configuration, refer to the component manuals below.

For build and test of the module itself, please refer to the main documentation.

Component Manuals
-----------------
Comment on lines +44 to +45

For detailed component-specific user manuals:

.. toctree::
:maxdepth: 1

/score/time/docs/manuals/user_manual
/score/time_slave/docs/manuals/user_manual
/score/time_daemon/docs/manuals/user_manual

Environment Needs
=================

Basic needed software environment for the module:

* **C++**: C++17 or later
* **Build System**: Bazel 6.0 or later
* **Operating Systems**: Linux, QNX

Dependencies
------------

* Standard library (STL/Core)
* PTP Grandmaster Clock (external network time source)
* POSIX shared memory support
* Network hardware with PHC (PTP Hardware Clock) support

See also MODULE.bazel files for more details on dependencies.

Performance Considerations
==========================

The ``time`` module is designed for high-performance, low-latency time access in automotive ECUs:

* **VehicleTime access**: Sub-microsecond latency via POSIX shared memory with seqlock
* **Lock-free IPC**: TimeDaemon reads from TimeSlave without blocking
* **Hardware clock sync**: Direct PHC adjustment for nanosecond-precision synchronization
* **Minimal overhead**: Singleton pattern, zero allocations in time-critical paths

For detailed performance analysis and benchmarks, this information will be added in future releases.

Integration Guidelines
======================

Integrating with Your Project
------------------------------

1. Add the module to your Bazel workspace:

.. code-block:: python

# In your MODULE.bazel
bazel_dep(name = "score_time", version = "1.0")

2. Reference in your build files:

.. code-block:: python

cc_library(
name = "my_target",
deps = ["@score_time//score/time/vehicle_time:vehicle_time"],
)

3. Include headers and compile your code

.. For detailed API usage and examples, refer to the :doc:`/score/time/docs/manuals/user_manual`.

Comment on lines +109 to +112
System Services Deployment
---------------------------

The ``time`` module requires two system daemons to be running. These processes must be managed by the system's service manager (e.g., `systemd` on Linux, or a launch script on QNX).

.. For detailed configuration of each daemon (OS privileges, network configuration, command-line arguments), refer to the :ref:`component_manuals<component manuals>` linked above.

Comment on lines +116 to +119
Version History, Compatibility, and Troubleshooting
===================================================

For comprehensive information on the following topics:

* Version history and changes
* Compatibility notes and upgrade instructions
* Known issues and limitations
* Troubleshooting tips and solutions
* Security vulnerabilities (CVEs)

.. toctree::
:maxdepth: 1

troubleshooting_guide

Safety and Security
===================

**Safety Classification**: QM (Quality Managed)

This module is designed for Quality Managed (QM) applications. For safety-critical usage requirements and guidelines, refer to the safety manual (to be added in future releases).

**Security Considerations**:

* The ``time`` module assumes a trusted network for PTP communication
* No authentication or encryption is provided for PTP messages (per IEEE 1588 standard)
* OS-level security (Linux Capabilities) limits attack surface for TimeSlave daemon

For detailed security aspects and requirements, refer to the security manual (to be added in future releases).

License
=======

This module is licensed under the Apache License Version 2.0.
See the LICENSE file in the repository for full license text.

Feedback and Contributions
==========================

Your feedback and contributions are welcome! Please report issues or suggestions through the
project's issue tracker or contribute directly to the repository.
11 changes: 9 additions & 2 deletions docs/index.rst → index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,20 @@ The main responsibilities of time_daemon include:
- **Providing diagnostic information** for system monitoring
- **Supporting additional verification mechanisms** such as QualifiedVehicleTime (QVT) for safety-critical applications

For a detailed concept and architectural design, please refer to the :doc:`time_daemon Concept Documentation <features/time_daemon/index>`.
For a detailed concept and architectural design, please refer to the :doc:`time_daemon Concept Documentation <docs/features/time_daemon/index>`.

.. toctree::
:maxdepth: 2
:caption: Contents:

features/index
docs/features/index
docs/manuals/index

.. toctree::
:maxdepth: 1
:caption: Component Documentation:

score/time_slave/docs/index

Project Layout
--------------
Expand Down
Loading
Loading