Skip to content

Commit 736886c

Browse files
committed
DOS 'PDC_napmsl()' didn't round to the nearest clock tick correctly. The quantity added should have been 23590, about half the divisor 47181. With the incorrect value, naps would be one tick (about 55 milliseconds) shorter than they should be about 40% of the time. Unsurprisingly, nobody noticed. (But it was _wrong_.)
1 parent 07a5469 commit 736886c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

common/dosutil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void PDC_napmsl( long ms)
4343
that would overflow, and we'd need floating point math.
4444
47181/859 = MS_PER_DAY / MAX_TICK to within four parts per
4545
billion and won't overflow (because 0 <= ms <= MAX_NAP_SPAN). */
46-
ticks_to_wait = (ms * 859L + 2359L) / 47181L;
46+
ticks_to_wait = (ms * 859L + 23590L) / 47181L;
4747
if( ms && !ticks_to_wait)
4848
ticks_to_wait = 1;
4949
tick0 = getdosmemdword(0x46c);

0 commit comments

Comments
 (0)