The main "Ping"/"Time" function for the game is this:
Net Code For Server - Time/Ping
Outside of the switch, TimeSync() functions like this:
private void TimeSync()
{
YGConnection.Send("Time", DateTime.UtcNow.Millisecond);
}
It sends the current UTCNow.Millisecond time to the server.
Finally, getTime() gets the current time + the offset of the server.
private double getTime()
{
return Math.Round((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds) + Offset;
}
It all works, but the numbers produced are like this:
Version 0.1.5 : Server time offset: -486335789940 - Ping: -943491433067
The server basically sends getTime() back, but without the offset. I'm wondering what is going on with the negative numbers and if there is anything I can do to fix that.