rendered paste body#include <unistd.h> // for usleep
#include <stdio.h> // for printf()
#include <stdlib.h> // for atof()
/* compile with
gcc -g -Wall -o smallsleep smallsleep.c
*/
#define MICROSECONDS_IN_SECONDS 1000000
int main (int argc, const char *argv[])
{
if (argc != 2) {
fprintf (stderr, "usage: %s time-in-seconds\n", argv[0]);
fprintf (stderr, " (decimal values are OK for the time\n");
return (1);
}
float fraction;
fraction = atof (argv[1]);
usleep (fraction * MICROSECONDS_IN_SECONDS);
return (0);
} // main