From 6989fbda61d9bc7cf7270d65b53efa92cbf88cc6 Mon Sep 17 00:00:00 2001 From: lidgren Date: Tue, 21 Dec 2010 19:40:02 +0000 Subject: [PATCH] tiny additions --- Lidgren.Network/NetConnection.Latency.cs | 9 +++++++-- Lidgren.Network/NetIncomingMessage.Read.cs | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lidgren.Network/NetConnection.Latency.cs b/Lidgren.Network/NetConnection.Latency.cs index ca832d4..61afc68 100644 --- a/Lidgren.Network/NetConnection.Latency.cs +++ b/Lidgren.Network/NetConnection.Latency.cs @@ -17,9 +17,14 @@ namespace Lidgren.Network /// public float AverageRoundtripTime { get { return m_averageRoundtripTime; } } - internal double GetLocalTime(double remoteTimeStamp) + public double GetLocalTime(double remoteTimestamp) { - return remoteTimeStamp - m_remoteTimeOffset; + return remoteTimestamp - m_remoteTimeOffset; + } + + public double GetRemoteTime(double localTimestamp) + { + return localTimestamp + m_remoteTimeOffset; } internal void InitializePing() diff --git a/Lidgren.Network/NetIncomingMessage.Read.cs b/Lidgren.Network/NetIncomingMessage.Read.cs index 5160b7b..759b657 100644 --- a/Lidgren.Network/NetIncomingMessage.Read.cs +++ b/Lidgren.Network/NetIncomingMessage.Read.cs @@ -476,6 +476,7 @@ namespace Lidgren.Network if (m_senderConnection == null) throw new NetException("Cannot call ReadTime() on message without a connected sender (ie. unconnected messages)"); + // lets bypass NetConnection.GetLocalTime for speed return remoteTime - m_senderConnection.m_remoteTimeOffset; }