getTimeServer() return less than zero value

Hello. I use c++ SDK for creating master server. I got demo loadBalancing from c++ SDK as base.
My application(server) are multithread. In first thread running event-loop(based on libev). Second thread are using for creating rooms. I read getTimeServer every 100ms and if returned value less than zero I run fetchTimeOffset(). And everytime this function return less zero value.
This is log:

2018-08-17 13:55:29,354414 INFO NetworkLogic.cpp createRoomReturn() 381 localPlayerNr: 1
... room 668693 has been created
regularly sending dummy events now
2018-08-17 13:55:29,355539 INFO Client.cpp onEvent() 1918 EventData - code: 255
2018-08-17 13:55:29,356547 INFO NetworkLogic.cpp joinRoomEventAction() 293 Linux1199985216 joined the game

player 1 Linux1199985216 has joined the game
Count of players: 1 Room Name: 668693
S17 TIME: -1202209093
OFFSET: 1892752902
UTIME: 1200005301
S18 S19 TIME: -1202208050
OFFSET: 1892752901
UTIME: 1200006345
S20 S21 TIME: -1202206986
OFFSET: 1892752901
UTIME: 1200007409
S22 S23 TIME: -1202205903
OFFSET: 1892752901
UTIME: 1200008492


What I do wrong?

Comments

  • Hi @angelskieglazki.

    There is nothing wrong with negative timestamp values. They are perfectly valid. It is pointless to re-fetch the server time because of it being negative and it won't make it become positive, no matter how often you do it.
    The timestamp is a signed 32bit integer, which overflows every about 45 days and which reaches the highest positive value after about 22.5 days and then continues with the negative values for the next 22.5 days, until it reaches 0 again.
  • @Kaiserludi thankyou so much!
Sign In or Register to comment.