⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

calculate_offset_delay

Function calculate_offset_delay 

Source
pub fn calculate_offset_delay(
    t1: &NtpTimestamp,
    t2: &NtpTimestamp,
    t3: &NtpTimestamp,
    t4: &NtpTimestamp,
) -> NtpMeasurement
Expand description

Calculate clock offset and round-trip delay from NTP timestamps.

Using the standard NTP formulas (all in milliseconds):

  • offset = ((t2 - t1) + (t3 - t4)) / 2
  • delay = (t4 - t1) - (t3 - t2)

Where:

  • t1 = client transmit time (origin)
  • t2 = server receive time
  • t3 = server transmit time
  • t4 = client receive time