summaryrefslogtreecommitdiffstats
path: root/src/core/parseopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/parseopt.c')
-rw-r--r--src/core/parseopt.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/core/parseopt.c b/src/core/parseopt.c
index 38b1f29f9..514508357 100644
--- a/src/core/parseopt.c
+++ b/src/core/parseopt.c
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/menu.h>
#include <ipxe/settings.h>
#include <ipxe/params.h>
+#include <ipxe/timer.h>
#include <ipxe/parseopt.h>
/** @file
@@ -96,6 +97,27 @@ int parse_integer ( char *text, unsigned int *value ) {
}
/**
+ * Parse timeout value (in ms)
+ *
+ * @v text Text
+ * @ret value Integer value
+ * @ret rc Return status code
+ */
+int parse_timeout ( char *text, unsigned long *value ) {
+ unsigned int value_ms;
+ int rc;
+
+ /* Parse raw integer value */
+ if ( ( rc = parse_integer ( text, &value_ms ) ) != 0 )
+ return rc;
+
+ /* Convert to a number of timer ticks */
+ *value = ( ( value_ms * TICKS_PER_SEC ) / 1000 );
+
+ return 0;
+}
+
+/**
* Parse network device name
*
* @v text Text