1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 15:16:33 +09:00

tiny additions

This commit is contained in:
lidgren
2010-12-21 19:40:02 +00:00
parent 330c5cf83e
commit 6989fbda61
2 changed files with 8 additions and 2 deletions

View File

@@ -17,9 +17,14 @@ namespace Lidgren.Network
/// </summary> /// </summary>
public float AverageRoundtripTime { get { return m_averageRoundtripTime; } } 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() internal void InitializePing()

View File

@@ -476,6 +476,7 @@ namespace Lidgren.Network
if (m_senderConnection == null) if (m_senderConnection == null)
throw new NetException("Cannot call ReadTime() on message without a connected sender (ie. unconnected messages)"); 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; return remoteTime - m_senderConnection.m_remoteTimeOffset;
} }