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

Re-added ReadTime()

This commit is contained in:
lidgren
2012-04-03 07:26:30 +00:00
parent 0a0e319f21
commit 271675a8ea
4 changed files with 36 additions and 2 deletions

View File

@@ -601,6 +601,20 @@ namespace Lidgren.Network
return true;
}
/// <summary>
/// Reads a value, in local time comparable to NetTime.Now, written using WriteTime() for the connection supplied
/// </summary>
public double ReadTime(NetConnection connection, bool highPrecision)
{
double remoteTime = (highPrecision ? ReadDouble() : (double)ReadSingle());
if (connection == null)
throw new NetException("Cannot call ReadTime() on message without a connected sender (ie. unconnected messages)");
// lets bypass NetConnection.GetLocalTime for speed
return remoteTime - connection.m_remoteTimeOffset;
}
/// <summary>
/// Reads a stored IPv4 endpoint description
/// </summary>