qa: improve newlib/040-gettimeofday.c
This commit is contained in:
		| @@ -1,15 +1,13 @@ | |||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <sys/time.h> | #include <sys/time.h> | ||||||
|  | #include <unistd.h> | ||||||
|  |  | ||||||
| int main (int argc, char** argv) { | int main (int argc, char** argv) { | ||||||
| 	struct timeval tvalBefore, tvalAfter; | 	struct timeval tvalBefore, tvalAfter; | ||||||
| 	long delta; | 	long delta; | ||||||
|  |  | ||||||
| 	gettimeofday (&tvalBefore, NULL); | 	gettimeofday (&tvalBefore, NULL); | ||||||
| 	int i =0; | 	sleep(2); | ||||||
| 	while (i < 100000000) |  | ||||||
| 		i++; |  | ||||||
|  |  | ||||||
| 	gettimeofday (&tvalAfter, NULL); | 	gettimeofday (&tvalAfter, NULL); | ||||||
|  |  | ||||||
| 	// Changed format to long int (%ld), changed time calculation | 	// Changed format to long int (%ld), changed time calculation | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user