5 Struct N_CLOCK_SYNC
gullradriel edited this page 2026-10-09 00:55:18 +02:00

N_CLOCK_SYNC

Module: CLOCK_SYNC: client/server clock offset estimation

clock synchronization estimator

#include "n_clock_sync.h"

Public Attributes

Name
int synthetic
TRUE while the buffer holds only a synthetic n_clock_sync_seed sample, flushed wholesale by the first real response so a low-synthetic-rtt seed can never pin the estimate on links whose real RTT exceeds the synthetic one.
int sample_index
current write position in circular buffer
int sample_count
number of samples collected so far
double[11] rtt_samples
circular buffer of RTT values
double[11] offset_samples
circular buffer of offset estimates
double offset_prev
effective offset at the moment estimated_offset last changed, the slew blends offset_prev -> estimated_offset
double offset_change_time
local time at which estimated_offset last changed
double last_sync_time
local time of last sync request sent
double estimated_rtt
current estimated round-trip time
double estimated_offset
add to local time to get estimated server time (raw best-RTT target, n_clock_sync_server_time applies the slew on top)

Public Attributes Documentation

variable synthetic

int synthetic;

TRUE while the buffer holds only a synthetic n_clock_sync_seed sample, flushed wholesale by the first real response so a low-synthetic-rtt seed can never pin the estimate on links whose real RTT exceeds the synthetic one.

variable sample_index

int sample_index;

current write position in circular buffer

variable sample_count

int sample_count;

number of samples collected so far

variable rtt_samples

double[11] rtt_samples;

circular buffer of RTT values

variable offset_samples

double[11] offset_samples;

circular buffer of offset estimates

variable offset_prev

double offset_prev;

effective offset at the moment estimated_offset last changed, the slew blends offset_prev -> estimated_offset

variable offset_change_time

double offset_change_time;

local time at which estimated_offset last changed

variable last_sync_time

double last_sync_time;

local time of last sync request sent

variable estimated_rtt

double estimated_rtt;

current estimated round-trip time

variable estimated_offset

double estimated_offset;

add to local time to get estimated server time (raw best-RTT target, n_clock_sync_server_time applies the slew on top)