Code & Wagyu  /  Apps  /  Prime Time

Prime Time App Icon

Millisecond precision.
How it works.

Your iPhone's clock is "close enough." Prime Time isn't satisfied with that.
Here's the full story — from the NTP query to the digit you see on screen.

--:--:--.---
The Basics Reading the UI Under the Hood
01 — The Basics

Ask the source.
Not the device.

Prime Time bypasses your device's internal clock entirely. Instead, it queries NTP (Network Time Protocol) servers directly — the same global infrastructure that keeps the internet synchronized — and calculates the correct time from their responses.

By default, three high-reliability servers are queried in parallel: time.google.com, time.aws.com, and pool.ntp.org. Their answers are fused statistically to produce a single, trustworthy result.

Why multiple servers?

A single server query is subject to momentary congestion, routing asymmetry, and outlier responses. Querying multiple servers simultaneously allows Prime Time to detect and discard anomalous results, then weight the remaining answers by their network latency. The lower the round-trip time, the more trustworthy the response.

Server Nodes  ●  syncing
Host Offset / RTT Status
time.google.com
INT: 45s
OFF
RTT
+0.003s 18ms T-032.4
time.aws.com
INT: 15s
OFF
RTT
+0.008s 34ms T-008.1
pool.ntp.org
INT: 120s
OFF
RTT
+0.002s 22ms T-097.8
02 — Reading the UI

Every number
has a meaning.

The large HH:mm:ss at the top is the NTP-corrected current time. The .000 beneath it is the millisecond component, updating at up to 120 Hz on supported hardware. The thin progress bar below represents the fractional position within the current second — it sweeps from left to right in exactly one second.

Graph Panels

GLOBAL OFFSET shows the difference between the NTP-corrected time and your device's internal clock, in seconds. A value close to zero means your device clock happens to be accurate.

σ DEVIATION is the standard deviation of the offset values across all active servers. Smaller is better. The color of this panel reflects overall sync quality.

Green
σ < 5 ms
High precision
Yellow
σ < 50 ms
Normal
Red
σ ≥ 50 ms
Unstable
Global Offset (5m)
+0.003s
σ Deviation (5m)
±0.002s

Server Row Legend

Status dot

Success
Querying
Idle
Failed

T- countdown

Seconds until next
server query

INT: Xs

Current query
interval (15–180 s)
03 — Under the Hood

Why you can trust
the decimal places.

RTT & One-Way Delay Correction

The time between sending an NTP request and receiving the response is called the Round-Trip Time (RTT). The timestamp the server returns reflects the moment the server sent its packet — not the moment you received it. By the time your device reads it, half the RTT has already elapsed.

Prime Time adds RTT ÷ 2 to every server timestamp before using it, compensating for this one-way propagation delay.

// NTP server response ntpTime = 12:00:00.000 rtt = 0.036s // 36 ms round-trip // Correct for one-way transit corrected = ntpTime + (rtt / 2) = 12:00:00.018

Monotonic Clock — No OS Interference

iOS's Date() can jump forward or backward when the OS applies a time correction. Prime Time avoids this by using CACurrentMediaTime() — a monotonic clock that counts elapsed seconds since boot without ever being adjusted.

When an NTP result arrives, Prime Time records both the corrected NTP time and the current monotonic value as a pair. Every subsequent display frame computes the current time as:

NTP-corrected absolute time
referenceNTPTime  =  12:00:00.018
recorded simultaneously
Monotonic clock snapshot
referenceMonotonicTime  =  3600.000 s
0.5 seconds later, on display refresh
Displayed time
12:00:00.018 + (3600.500 − 3600.000) =  12:00:00.518
Key point: The device's internal clock is never read for display purposes. Only the NTP reference time and the monotonic elapsed delta are used. OS time corrections cannot disturb what you see on screen.

RTT-Weighted Multi-Server Fusion

Each server's answer is assigned a weight inversely proportional to its RTT. A server that responds in 18 ms is weighted more heavily than one that takes 80 ms, because a shorter round-trip implies a smaller and more symmetric propagation uncertainty. Responses that fall outside two standard deviations from the median are discarded before the weighted average is computed.

// Weight each server by inverse RTT google  RTT=18ms    weight = 55.6 aws    RTT=34ms    weight = 29.4 pool   RTT=22ms    weight = 45.5 // Discard outliers (|value − median| > 2σ) outlier    excluded // Weighted average of remaining responses result  =  weighted mean of valid responses

Adaptive Query Interval

Prime Time adjusts how often each server is queried based on the stability of its responses. When a server is delivering consistent results, the interval expands — reducing unnecessary traffic. When variance increases, the interval collapses back to the minimum to re-establish a reliable reference quickly.

Stable
180s

σ < 5 ms sustained. Interval extends gradually to reduce server load.

Unstable
15s

σ > 50 ms detected. Interval resets to minimum to re-sync quickly.

Roadmap

Version 1.0 (Current): Prime Time is currently available for free, allowing you to register and query up to 5 NTP servers simultaneously.

Version 2.0 (Upcoming): The app will transition to a paid model. This major update will unlock a higher limit for server registration and introduce refined time-correction algorithms—such as slew-rate control for smoother, jump-free offset convergence.

← Back to Home All Apps