blob: b309440db014857bb43b2c93226ed4feeca9c3cf [file] [log] [blame]
Andrew Top61a84952019-04-30 15:07:33 -07001// RUN: %libomp-compile-and-run
2#include <stdio.h>
3#include <stdlib.h>
4#include "omp_testsuite.h"
5#include "omp_my_sleep.h"
6
7int test_omp_get_wtime()
8{
9 double start;
10 double end;
11 double measured_time;
12 double wait_time = 5.0;
13 start = 0;
14 end = 0;
15 start = omp_get_wtime();
16 my_sleep (wait_time);
17 end = omp_get_wtime();
18 measured_time = end-start;
19 return ((measured_time > 0.97 * wait_time) && (measured_time < 1.03 * wait_time)) ;
20}
21
22int main()
23{
24 int i;
25 int num_failed=0;
26
27 for(i = 0; i < REPETITIONS; i++) {
28 if(!test_omp_get_wtime()) {
29 num_failed++;
30 }
31 }
32 return num_failed;
33}