private void UpdateRealServerTime() { long minServerTime = this.GetMinServerTime(); if (minServerTime != 0L) { long num = 0L; int num2 = 0; long num3 = 0L; for (int i = 0; i < this.timeSyncInfoReceived.Length; i++) { TimeSyncInfo timeSyncInfo = this.timeSyncInfoReceived[i]; if (timeSyncInfo.ping > 0L) { num += timeSyncInfo.realServerTime - minServerTime + this.clientWorldTime - timeSyncInfo.clientTimeWhenReceived; num3 += timeSyncInfo.ping; num2++; } } if (num2 > 0) { this.ping = num3 / (long)num2; long num4 = num / (long)num2 + minServerTime; this.realServerTime = num4; this.realServerPing = this.ping; } } }
private void PrecisionCorrection(TimeSyncInfo info) { long num = this.realServerTime - info.realServerTime; if (num < -20L) { this.realServerTime += 1L; } else if (num > 20L) { this.realServerTime -= 1L; } }
private long GetMinServerTime() { long num = 0L; for (int i = 0; i < this.timeSyncInfoReceived.Length; i++) { TimeSyncInfo timeSyncInfo = this.timeSyncInfoReceived[i]; if (timeSyncInfo.ping > 0L) { if (num == 0L) { num = timeSyncInfo.realServerTime; } else if (num > timeSyncInfo.realServerTime) { num = timeSyncInfo.realServerTime; } } } return(num); }