Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
clock_alignment.h File Reference

Bounded mapping between flight-controller microseconds and USHER monotonic time. More...

#include <stddef.h>
#include "usher_protocol.h"
Include dependency graph for clock_alignment.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  clock_interval
 Inclusive USHER monotonic-time bounds for a mapped controller timestamp. More...
struct  clock_alignment
 Stateful evidence for at most one pending and one accepted clock probe. More...

Macros

#define CLOCK_ALIGNMENT_MAX_RTT_US   UINT64_C(100000)
#define CLOCK_ALIGNMENT_MAX_AGE_US   UINT64_C(2000000)
#define CLOCK_ALIGNMENT_DRIFT_PPM   UINT64_C(1000)

Functions

bool clock_alignment_request (struct clock_alignment *clock, union usher_clock_request_union token, uint64_t sent_us)
 Register a newly transmitted clock probe.
bool clock_alignment_reply (struct clock_alignment *clock, const uint8_t *payload, size_t length, uint64_t received_us)
 Validate a flight-controller clock reply and establish a mapping anchor.
bool clock_alignment_map (const struct clock_alignment *clock, union usher_clock_request_union token, uint32_t fc_us, uint64_t now_us, struct clock_interval *interval)
 Project a controller timestamp into a conservative USHER time interval.

Detailed Description

Bounded mapping between flight-controller microseconds and USHER monotonic time.

The protocol exchanges a random token and controller receive/transmit times. The resulting interval is deliberately bounded, short-lived, and token-associated so stale replies or a wrapped 32-bit controller clock cannot geotag audio with false precision.

Definition in file clock_alignment.h.

Macro Definition Documentation

◆ CLOCK_ALIGNMENT_DRIFT_PPM

#define CLOCK_ALIGNMENT_DRIFT_PPM   UINT64_C(1000)

Conservative oscillator drift allowance used to widen projected intervals.

Definition at line 38 of file clock_alignment.h.

◆ CLOCK_ALIGNMENT_MAX_AGE_US

#define CLOCK_ALIGNMENT_MAX_AGE_US   UINT64_C(2000000)

Lifetime of a mapping before drift uncertainty makes it unsuitable for correlation.

Definition at line 36 of file clock_alignment.h.

◆ CLOCK_ALIGNMENT_MAX_RTT_US

#define CLOCK_ALIGNMENT_MAX_RTT_US   UINT64_C(100000)

Maximum acceptable probe round trip; larger samples are not useful evidence.

Definition at line 34 of file clock_alignment.h.

Function Documentation

◆ clock_alignment_map()

bool clock_alignment_map ( const struct clock_alignment * clock,
union usher_clock_request_union token,
uint32_t fc_us,
uint64_t now_us,
struct clock_interval * interval )

Project a controller timestamp into a conservative USHER time interval.

Parameters
clockAccepted alignment state.
tokenToken proving the pose belongs to this probe epoch.
fc_us32-bit controller microsecond timestamp.
now_usCurrent USHER monotonic time, used to reject stale/future projections.
intervalReceives inclusive projected bounds.
Returns
True when interval contains a plausible mapping.
Warning
The result is an interval, not a claimed exact timestamp.

Definition at line 75 of file clock_alignment.c.

◆ clock_alignment_reply()

bool clock_alignment_reply ( struct clock_alignment * clock,
const uint8_t * payload,
size_t length,
uint64_t received_us )

Validate a flight-controller clock reply and establish a mapping anchor.

Parameters
clockMutable synchronization state.
payloadExact reply payload bytes.
lengthPayload length.
received_usUSHER monotonic receive timestamp.
Returns
True only for a matching, bounded-latency reply.

Rather than guessing a one-way delay, this stores an interval spanning the possible controller transmit instant, including bounded service time and clock drift.

Definition at line 50 of file clock_alignment.c.

◆ clock_alignment_request()

bool clock_alignment_request ( struct clock_alignment * clock,
union usher_clock_request_union token,
uint64_t sent_us )

Register a newly transmitted clock probe.

Parameters
clockMutable synchronization state.
tokenNonzero random token carried on the wire.
sent_usUSHER monotonic timestamp at transmission.
Returns
True if the probe is accepted as pending.

Tokens must not repeat the pending or last accepted probe; this prevents a delayed reply from being mistaken for fresh timing evidence.

Definition at line 39 of file clock_alignment.c.