1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright 2015, Anton Blanchard, IBM Corp.
11 static int test_gettimeofday(void)
15 struct timeval tv_start
, tv_end
, tv_diff
;
17 gettimeofday(&tv_start
, NULL
);
19 for(i
= 0; i
< 100000000; i
++) {
20 gettimeofday(&tv_end
, NULL
);
23 timersub(&tv_end
, &tv_start
, &tv_diff
);
25 printf("time = %.6f\n", tv_diff
.tv_sec
+ (tv_diff
.tv_usec
) * 1e-6);
32 return test_harness(test_gettimeofday
, "gettimeofday");