Measure OS timer precision to refine calibration

Do not trust the OS at all and measure timer precision before
calibrating the delay loop and use that measurement to get reasonable
precision for our own delay code.

Print a measurement for a delay of 4x the OS timer resolution.

Be precise about how bad the deviation was if we had to recalculate.

Tested on Windows XP, 32 bit, built using MinGW by Uwe. Tested on
FreeDOS v1.0 Final, 32bit, built using DJGPP 4.3.2 by Idwer.

Corresponding to flashrom svn r1028.

Signed-off-by: Carl-Daniel Hailfinger <>
Acked-by: Uwe Hermann <>
Acked-by: Idwer Vollering <>
1 file changed