#include #include struct timeval tv1, tv2; struct timezone tz; void getTime(float time) { (void) gettimeofday(&tv1, &tz); sleep((int)time); (void) gettimeofday(&tv2, &tz); printf("sleep %fsec, tv1=%d.%d, tv2=%d.%d\n", time, tv1.tv_sec, tv1.tv_usec, tv2.tv_sec, tv2.tv_usec) ; } main() { float time; int i; for (i=0; i<100 & time > 0; i++) { printf("enter sec number:\n"); scanf("%f", &time); printf("time=%f\n", time); getTime(time); } }