This started as an investigation into a player exploit: some players discovered that by setting their system clock back, they could effectively stop their game clock, and as a knock-on effect avoid time penalties. I installed some simple code to force time to move monotonically forward, and I thought, detect cheats.
Much to my surprise, instead of detecting cheats, I found it was fairly common (perhaps once per hundred player hours) for time to jump backwards by a minute or two, under circumstances where I have no reason to suspect anyone was trying to cheat.
The simple version of the “monotonic time” code is this:
static long last_time = -1;
static long time_offset = 0;
// this needs to be synchronized so different threads can’t
// see decreasing times
static public synchronized long Date()
{ long this_time = (new Date().getTime());
if(this_time<last_time) { time_offset += (last_time-this_time); }
last_time = this_time;
return(time_offset+this_time);
}
I would expect the time offset to remain zero. In fact, once in a while it jumps by anything up to 3 minutes. A more elaborate version of this is collecting data as we speak. I’d be interested to hear any theories about what is going on.