Jump to content
  • Advertisement
Sign in to follow this  
Cold_Flame

Server Timer Overflow

This topic is 4403 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I'm using timeGetTime for the server's timing purposes, eg sync and packet timestamps. So i got this idea: timeGetTime's timer (afaik any other system timer too) overflows around every 50 days. What happens when the server runs nonstop for 50 days and it happens? Mini-y2k? The client remembers the last packet it received had a 0xffffffff timestamp (eg) and the new packets have timestamps starting from zero. It's supposed to discard them, since they are out-of-date... Do i have to handle this problem explicitly or it's not really a problem at all? One solution could be sending a special packet telling the client "hey, reset your timestamp because I did so". Still, the server still has to check for overflow every tick. Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
Time-stamps will roll over to 0x00000000.

When you compare time stamps, you really shouldn't be comparing stamps directly (say, "if (a > b)"); instead, you should only be comparing deltas (say, "if(a-b > 0)"). This means that, as long as any interval is less than the maximum signed integer value, you'll be OK, even with wrapping.

In fact, you can test this yourself by making your timestamp data type be only 16 bits, for debugging purposes.

Share this post


Link to post
Share on other sites
Just out of interest MS Proxy Server used to have a problem; when the timer overflowed, reporting stopped working. The service/server had to be restarted every few months. Be careful with using time values for labeling things, eg log files.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!