[En-Nut-Discussion] Request for Comment: NutTimerMillisToTicks()
Harald Kipp
harald.kipp at egnite.de
Mon May 15 18:35:32 CEST 2006
Hi all,
Shane Buckham and Michael Fischer recently reported, that
the calculation in NutTimerMillisToTicks() is wrong.
return ms * 1000L / NutGetTickClock();
should have been
return ms * NutGetTickClock() / 1000L;
Michael already corrected this for the LPC2xxx, but for
all remaining platforms it is still wrong. It had been
undetected, because typically NutGetTickClock() returns
1000.
Here's the request: Michael modified NutTimerMillisToTicks()
in that way, that it returns at least 1, never 0. As far as
I can see, it would not make any difference if the one-shot
timer is started with 0 or 1 ticks left. In my view Michael's
solution looks cleaner.
Harald
More information about the En-Nut-Discussion
mailing list