I am trying to program my own chess clock and would like it to be as accurate as possible. Suppose 2 players, player A and player B, are playing a 15 minute game with a 2 second delay. Suppose A is white, and the game begins, and player A spends 2.5 seconds on his first move before hitting the clock. The first 2 seconds are "absorbed" by the delay, but what happens when it is his turn again? He will get the 2 second delay, but will 15:00 change to 14:59 half a second after the delay has finished, essentially giving him a free half-second? Or does the fractional time get rounded up to the nearest second? Similarly with increment.


Nothing gets rounded internally. If you are programming a chess clock, then maintain the time according to whatever the machine precision is on your machine without rounding. Some clocks have tenth seconds on their display, but that doesn't mean that they're altering the fundamental increments of time as compared to different clocks.

If A begins and spends 2.5 seconds on his first move, then he will have exactly 14:59.5 left. Just because it displays 15:00 doesn't mean that he still has 15:00. If he spent 2.6 seconds, then he has exactly 14:59.4 left, which may display as 14:59.

Likewise with increment. He will have exactly 14:57.5 + 2 = 14:59.5 seconds on his clock, which may display as 15:00.


In general:

  • With increment you have one clock, and that counts down while it is your move. When your move is complete, the increment time is then added back to your clock.

  • With delay you have 2 clocks, one for the current move and your main clock. The clock for your current move starts at the delay time, and if you exceed that, your main clock starts counting down instead. You only lose on time if your main clock goes down to 0 (or just below 0, so for example you can play 0 with 15 second delay in which case you must play all your moves in 15 seconds or less).

Delay is similar to the clock that sounds a tone and you move on the tone.

One huge advantage in online chess with a short clock time and a medium delay is you are more immune against "rage quitters". If you play with say 1 minute and 15 second delay, you will never have to wait more than 1 minute and 15 seconds if your opponent rage quits.

It can also be more "entertaining" to watch as players will never go into the "tank" so you'll see progress on the board, and games will be played out to a conclusion and not turn into a mad time-scramble with one player trying to flag the other.

That doesn't work as well with increment as players can blitz out their opening moves to get more time on their clock for the middle game.

(For those who wish to be able to make use of their time that way, I guess that's an advantage of increment).

I'm not interested in what is more cheat-proof. Cheats will cheat regardless of the time control.

For granularity of time, milliseconds is probably good enough, but you could store microseconds. For display to the user tenths of a second may be sufficient.


Essentially giving him a free second

This is not how a chess clock should work. The accuracy of the chess clock should be more than that you see while using it. If you are programming a chess clock for OTB play, then an accuracy of 100 milliseconds would be enough. However, for an online chess clock (one which gets automatically pressed when a move is made), this accuracy is not enough and could be exploited by the players, especially if premoving is an option.

When programming a chess clock, what I do is store the total time left for each player in milliseconds. Then, I write a function which will calculate the amount of hours, minutes, seconds and milliseconds (as necessary) to display them, and run this function every 10 milliseconds, each time subtracting 1 from the original time (in ms).

This way, while the clock may only show the time as 14:59, it will be able to store it as 14:59.625, for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.