Skip to content

Mirror::NetworkTime

Synchronize time between the server and the clients

Public Functions

Name
void Reset()

Public Attributes

Name
float PingFrequency
how often are we sending ping messages used to calculate network time and RTT
int PingWindowSize
average out the last few results from Ping
double time
The time in seconds since the server started.
double timeVar
Measurement of the variance of time.
double timeSd
standard deviation of time.
double offset
Clock difference in seconds between the client and the server
double rtt
how long in seconds does it take for a message to go to the server and come back
double rttVar
measure variance of rtt the higher the number, the less accurate rtt is
double rttSd
Measure the standard deviation of rtt the higher the number, the less accurate rtt is

Public Functions Documentation

function Reset

static inline void Reset()

Public Attributes Documentation

variable PingFrequency

static float PingFrequency = 2.0f;

how often are we sending ping messages used to calculate network time and RTT

variable PingWindowSize

static int PingWindowSize = 10;

average out the last few results from Ping

variable time

static double time => LocalTime() - _offset.Value;

The time in seconds since the server started.

variable timeVar

static double timeVar => _offset.Var;

Measurement of the variance of time.

The higher the variance, the less accurate the time is

variable timeSd

static double timeSd => Math.Sqrt(timeVar);

standard deviation of time.

The higher the variance, the less accurate the time is

variable offset

static double offset => _offset.Value;

Clock difference in seconds between the client and the server

Note this value is always 0 at the server

variable rtt

static double rtt => _rtt.Value;

how long in seconds does it take for a message to go to the server and come back

variable rttVar

static double rttVar => _rtt.Var;

measure variance of rtt the higher the number, the less accurate rtt is

variable rttSd

static double rttSd => Math.Sqrt(rttVar);

Measure the standard deviation of rtt the higher the number, the less accurate rtt is


Updated on 18 January 2021 at 03:17:53 UTC