Hi Tom,

> > Menu timeout set at 10 seconds. Boot kernel with menu at 23:59:55.
> > Timer expires at 00:00:00 (0-1.5M = very large number)
> and that's exactly the wanted behaviour.

is it? At least the comment doesn't say so, maybe it was in your head
though.

>
> > instead of  00:00:05.
>
> and to wait precisely 10 seconds in the case that someone boots
> FreeDOS at midnight AND is sitting at the keyboard AND thinks it's a
> bug that the timer gotes off early is simply not worth the code to
> handle this case.

well I do agree it's a highly unlikely situation.
>
> > >> +    if ((unsigned)(GetBiosTime() - startTime) >= timeout * 18u)
> and the original code uses long arithmetic on purpose.

The original code only pretends to use long arithmetic:

    if (GetBiosTime() - startTime >= (unsigned)timeout * 18)
      break;

The reason is that (unsigned)timeout * 18 is a 16 bit value.
GetBiosTime() - startTime will under normal circumstances (outside
midnight) *never* be >= 0x10000, since it increases step by step from 0
and bails out before it gets even close. Hence it is perfectly OK to cast
to (unsigned).

If you have a purpose to use long arithmetic then the original code needs
to be:

    if (GetBiosTime() - startTime >= (unsigned long)timeout * 18)
      break;

Now what am I missing here?

Bart



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to