
Hi Simon,
u32 end = time_future_ms(timeout);
do { ...blah... } while(time_now_ms() < end);
...
Actually:
} while (time_passed_ms(end))
Sorry, but I think you've lost me here...
but anyway I agree it is a matter of taste and I'm quite happy with the approach here at the moment.
But what about my question about signed ints for deltas?
We use signed int's to allow seamless roll-overs of the timer counter. One thing the API does not require is that a given low-level timer counts from zero - It can start with any value and therefore may roll-over at any time. By using unsigned provided there is at most one rollover between timing events (which for a 32-bit millisecond counter is a very long time) the logic remain trivial (time = end - start) - We don't have to try and detect the rollover.
Also, we assume the u-Boot will never be installed in a time machine, and will therefore never need to calculate negative time. Please let us know if you plan to boot a TARDIS using U-Boot ;)
Regards,
Graeme