使用 毫秒时间戳 传入 SetDifferenceTime,_isSecLevel = false,但是 _differenceTime 是毫秒的时间差,
获取 ServerNow 可以修改为
public static long ServerNow()
{
if (_isSecLevel)
{
return _differenceTime + ClientNowSeconds();
}
return _differenceTime + ClientNowMillisecond();//毫秒级
}
在 SetDifferenceTime 中可以修改为
if (_isSecLevel)
{
_differenceTime = timeSpan - ClientNowSeconds();
}
else
{
_differenceTime = timeSpan - ClientNowMillisecond();
}
使用 毫秒时间戳 传入 SetDifferenceTime,_isSecLevel = false,但是 _differenceTime 是毫秒的时间差,
获取 ServerNow 可以修改为
public static long ServerNow()
{
if (_isSecLevel)
{
return _differenceTime + ClientNowSeconds();
}
}
在 SetDifferenceTime 中可以修改为
if (_isSecLevel)
{
_differenceTime = timeSpan - ClientNowSeconds();
}
else
{
_differenceTime = timeSpan - ClientNowMillisecond();
}