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


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
-
clock Accepted alignment state. token Token proving the pose belongs to this probe epoch. fc_us 32-bit controller microsecond timestamp. now_us Current USHER monotonic time, used to reject stale/future projections. interval Receives inclusive projected bounds.
- Returns
- True when
intervalcontains 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
-
clock Mutable synchronization state. payload Exact reply payload bytes. length Payload length. received_us USHER 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
-
clock Mutable synchronization state. token Nonzero random token carried on the wire. sent_us USHER 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.