mirror of
https://github.com/xcat2/xNBA.git
synced 2025-02-19 12:04:32 +00:00
[console] Avoid timer wraparound problems in getchar_timeout()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
9e98e4b9b8
commit
2969a8567f
@ -39,9 +39,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
* @ret character Character read from console
|
||||
*/
|
||||
int getchar_timeout ( unsigned long timeout ) {
|
||||
unsigned long expiry = ( currticks() + timeout );
|
||||
unsigned long start = currticks();
|
||||
|
||||
while ( currticks() < expiry ) {
|
||||
while ( ( currticks() - start ) < timeout ) {
|
||||
step();
|
||||
if ( iskey() )
|
||||
return getchar();
|
||||
|
Loading…
x
Reference in New Issue
Block a user