STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
MonotonicTime.hpp File Reference

Centralized monotonic timestamp utilities for all FSW services. More...

#include <chrono>
#include <cstdint>
#include <ctime>
Include dependency graph for MonotonicTime.hpp:

Go to the source code of this file.

Namespaces

namespace  fsw
 Motorized ball valve position: raw ADC counts -> % open.
namespace  fsw::time

Functions

uint64_t fsw::time::monotonic_ns ()
 Get current monotonic time in nanoseconds since boot.
uint64_t fsw::time::monotonic_us ()
 Get current monotonic time in microseconds since boot.
uint64_t fsw::time::monotonic_ms ()
 Get current monotonic time in milliseconds since boot.
std::chrono::steady_clock::time_point fsw::time::monotonic_now ()
 Get current monotonic time as a steady_clock time_point.
uint64_t fsw::time::to_ns (std::chrono::steady_clock::time_point tp)
 Convert steady_clock time_point to nanoseconds since boot.
uint64_t fsw::time::elapsed_ns (std::chrono::steady_clock::time_point start, std::chrono::steady_clock::time_point end)
 Compute elapsed nanoseconds between two time points.

Detailed Description

Centralized monotonic timestamp utilities for all FSW services.

ALL services MUST use these functions for timestamps written to Elodin DB. This ensures consistent time correlation across daq_bridge, calibration_service, controller_service, sequencer_service, and data_logger_service.

Uses CLOCK_MONOTONIC (via std::chrono::steady_clock) which:

  • Never jumps backward (unlike system_clock / NTP)
  • Survives NTP corrections
  • Matches Elodin DB's internal monotonic timestamp

Definition in file MonotonicTime.hpp.