1/*
2 * Copyright (c) 2002-3, Intel Corporation. All rights reserved.
3 * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
4 * This file is licensed under the GPL license.  For the full content
5 * of this license, see the COPYING file at the top level of this
6 * source tree.
7
8 Test that the difftime function shall return the difference between
9 two calendar times.
10 */
11
12#define WAIT_DURATION 1
13
14#include <time.h>
15#include <stdio.h>
16#include <stdlib.h>
17#include <unistd.h>
18#include "posixtest.h"
19
20int main()
21{
22	time_t time1, time0;
23
24	double time_diff;
25	time_diff = 0;
26	time0 = time(NULL);
27	sleep(WAIT_DURATION);
28	time1 = time(NULL);
29	time_diff = difftime(time1, time0);
30
31	if (time_diff != WAIT_DURATION) {
32		perror("Test FAILED: difftime did not return the correct value\n");
33		return PTS_FAIL;
34	}
35
36	printf("Test PASSED\n");
37	return PTS_PASS;
38}
39
40