qa: improve newlib/040-gettimeofday.c

This commit is contained in:
Giacomo Tesio 2017-08-28 02:47:05 +02:00
parent 59e881c04d
commit 9bdbd9b09d
1 changed files with 2 additions and 4 deletions

View File

@ -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