|
@@ -548,17 +548,25 @@ static struct command_descriptor sleep_cmd =
|
548
|
548
|
*/
|
549
|
549
|
static int sleep_exec ( int argc, char **argv ) {
|
550
|
550
|
struct sleep_options opts;
|
551
|
|
- unsigned long start, delay;
|
|
551
|
+ unsigned int seconds;
|
|
552
|
+ unsigned long start;
|
|
553
|
+ unsigned long delay;
|
552
|
554
|
int rc;
|
553
|
555
|
|
554
|
556
|
/* Parse options */
|
555
|
557
|
if ( ( rc = parse_options ( argc, argv, &sleep_cmd, &opts ) ) != 0 )
|
556
|
558
|
return rc;
|
557
|
559
|
|
|
560
|
+ /* Parse number of seconds */
|
|
561
|
+ if ( ( rc = parse_integer ( argv[optind], &seconds ) ) != 0 )
|
|
562
|
+ return rc;
|
|
563
|
+
|
|
564
|
+ /* Delay for specified number of seconds */
|
558
|
565
|
start = currticks();
|
559
|
|
- delay = strtoul ( argv[1], NULL, 0 ) * ticks_per_sec();
|
|
566
|
+ delay = ( seconds * TICKS_PER_SEC );
|
560
|
567
|
while ( ( currticks() - start ) <= delay )
|
561
|
568
|
cpu_nap();
|
|
569
|
+
|
562
|
570
|
return 0;
|
563
|
571
|
}
|
564
|
572
|
|