YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.sendspin.client.ServerClock Class Reference

An estimate of the server clock for a client that only shows progress (a controller): the offset server - client, from bursts of client/time and server/time (spec, "Clock Synchronization"). More...

Collaboration diagram for de.yaacc.sendspin.client.ServerClock:
Collaboration graph

Public Member Functions

void add (long t1, long t2, long t3, long t4)
 One server/time reply of the running burst: T1 sent, T2 and T3 from the server, T4 received.
 
void endBurst ()
 The burst is over: its best measurement feeds the estimate.
 
boolean hasEstimate ()
 
long offsetMicros ()
 
long serverTimeAt (long clientMicros)
 The server clock at a time of the client clock; the client time itself before there is an estimate.
 

Static Public Member Functions

static long measurement (long t1, long t2, long t3, long t4)
 ((T2 - T1) + (T3 - T4)) / 2, integer division toward zero.
 
static long maxError (long t1, long t2, long t3, long t4)
 ((T4 - T1) - (T3 - T2)) / 2: half the round trip, the worst error of the offset.
 

Detailed Description

An estimate of the server clock for a client that only shows progress (a controller): the offset server - client, from bursts of client/time and server/time (spec, "Clock Synchronization").

Of each burst only the measurement with the lowest max_error above zero is used; successive bursts are smoothed, and a residual larger than three times the error starts a new baseline (the specification's adaptive cutoff). This is not the Kalman filter of the specification, which an audio player needs for sample accurate sync: a display is right to a few milliseconds with it. Pure; one thread.


The documentation for this class was generated from the following file: