diff options
author | Michael Brown | 2013-11-01 03:22:12 +0100 |
---|---|---|
committer | Michael Brown | 2013-11-01 03:26:19 +0100 |
commit | 5e1fa5cd4090f229a40903f13abf328e86271717 (patch) | |
tree | 77a6302aeeb86f6c86fe95fb757a952a4ef7490e /src/hci/tui | |
parent | [ipv6] Add ndp_tx_router_solicitation() to send router solicitations (diff) | |
download | ipxe-5e1fa5cd4090f229a40903f13abf328e86271717.tar.gz ipxe-5e1fa5cd4090f229a40903f13abf328e86271717.tar.xz ipxe-5e1fa5cd4090f229a40903f13abf328e86271717.zip |
[parseopt] Add parse_timeout()
Parsing a timeout value (specified in milliseconds) into an internal
timeout value measured in timer ticks is a common operation. Provide
a parse_timeout() value to carry out this conversion automatically.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci/tui')
-rw-r--r-- | src/hci/tui/menu_ui.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c index d5636f8b..42f7463f 100644 --- a/src/hci/tui/menu_ui.c +++ b/src/hci/tui/menu_ui.c @@ -303,11 +303,11 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) { * Show menu * * @v menu Menu - * @v wait_ms Time to wait, in milliseconds (0=indefinite) + * @v timeout Timeout period, in ticks (0=indefinite) * @ret selected Selected item * @ret rc Return status code */ -int show_menu ( struct menu *menu, unsigned int timeout_ms, +int show_menu ( struct menu *menu, unsigned long timeout, const char *select, struct menu_item **selected ) { struct menu_item *item; struct menu_ui ui; @@ -318,7 +318,7 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms, /* Initialise UI */ memset ( &ui, 0, sizeof ( ui ) ); ui.menu = menu; - ui.timeout = ( ( timeout_ms * TICKS_PER_SEC ) / 1000 ); + ui.timeout = timeout; list_for_each_entry ( item, &menu->items, list ) { if ( item->label ) { if ( ! labelled_count ) |