- argc -= optind;
- argv += optind;
-
- if (argc != 1)
- usage();
-
- /*
- * Okay, why not just use atof for everything? Why bother
- * checking if there is a fraction in use? Because the old
- * sleep handled the full range of integers, that's why, and a
- * double can't handle a large long. This is fairly useless
- * given how large a number a double can hold on most
- * machines, but now we won't ever have trouble. If you want
- * 1000000000.9 seconds of sleep, well, that's your
- * problem. Why use an isdigit() check instead of checking for
- * a period? Because doing it this way means locales will be
- * handled transparently by the atof code.
- */
- fracflag = 0;
- arg = *argv;
- for (temp = arg; *temp != '\0'; temp++)
- if (!isdigit(*temp))
- fracflag++;
-
- if (fracflag) {
- val = atof(arg);
- if (val <= 0)
- exit(0);
- ival = floor(val);
- fval = (1000000000 * (val-ival));
- ntime.tv_sec = ival;
- ntime.tv_nsec = fval;