You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-17 15:46:33 +09:00
Fix for time issue 129; thanks to jujjyl
This commit is contained in:
@@ -270,7 +270,7 @@ namespace Lidgren.Network
|
|||||||
int maxCHBpS = 1250 - m_connections.Count;
|
int maxCHBpS = 1250 - m_connections.Count;
|
||||||
if (maxCHBpS < 250)
|
if (maxCHBpS < 250)
|
||||||
maxCHBpS = 250;
|
maxCHBpS = 250;
|
||||||
if (delta > (1.0 / (double)maxCHBpS)) // max connection heartbeats/second max
|
if (delta > (1.0 / (double)maxCHBpS) || delta < 0.0) // max connection heartbeats/second max
|
||||||
{
|
{
|
||||||
m_frameCounter++;
|
m_frameCounter++;
|
||||||
m_lastHeartbeat = dnow;
|
m_lastHeartbeat = dnow;
|
||||||
|
|||||||
@@ -40,10 +40,12 @@ namespace Lidgren.Network
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static double Now { get { return (double)(Stopwatch.GetTimestamp() - s_timeInitialized) * s_dInvFreq; } }
|
public static double Now { get { return (double)(Stopwatch.GetTimestamp() - s_timeInitialized) * s_dInvFreq; } }
|
||||||
#else
|
#else
|
||||||
|
private static readonly uint s_timeInitialized = (uint)Environment.TickCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get number of seconds since the application started
|
/// Get number of seconds since the application started
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static double Now { get { return (double)Environment.TickCount / 1000.0; } }
|
public static double Now { get { return (double)((uint)Environment.TickCount - s_timeInitialized) / 1000.0; } }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user