cutechess icon indicating copy to clipboard operation
cutechess copied to clipboard

Time precision for saving to pgn (ENHANCEMENT)

Open rwbc opened this issue 5 years ago • 3 comments

I would like to see a setting for changing the time precision saved to pgn. This remains currently the last change I always do for my own compilations. (Except changing evalhistory colors, which seems to come anyway in the future, following the new board settings)

I prefer a precision of two digits, except for very long time controls, but YMMV.

Thanks for all the work on cutechess so far!

Guenther

rwbc avatar Oct 01 '20 08:10 rwbc

Could you please give a short example so that we can see what the original output has been and what your changes look like?

alwey avatar Oct 01 '20 11:10 alwey

Hi alwey, currently I am doing this (second part),

lib/src/chessgame.cpp

...............................
43	int precision = 0;
44	if (t < 100)
45		precision = 3;
46	else if (t < 1000)
47		precision = 2;
48	else if (t < 10000)
49		precision = 1;
...............................
	int precision = 2;
	if (t < 100)
		precision = 3;
	else if (t > 100000)
		precision = 1;
...............................

rwbc avatar Oct 01 '20 15:10 rwbc

Yes, I think your change is valid. I guess the accuracy of the time span measurement will be in the 30 ppm order of magnitude from the system clock (quartz based) of the machine hosting the engine(s). And we have quantisation noise from the timer (interrupt / implementation) and a jitter from system activity.

From this I would deduce, in order to be on the safe side:

precision = 0;        // format: 1001s
if (t  < 100)         // format: 0.099s
      precision = 3;
else if (t < 100000)  // format: 99.99s
      precision = 2;
else if (t < 1000000) // format: 999.9s
      precision = 1;

If we assume that host systems get timing updates from more precise sources, e.g. NTP, I think it will be OK to extend the valid range of precison = 1 . This is what you do above 1000 s.

References: Significant Figures Signifikante Stellen

alwey avatar Oct 02 '20 10:10 alwey