xref: /iperf/src/t_timer.c (revision 56a97f93)
1 /*
2  * Copyright (c) 2009-2011, The Regents of the University of California,
3  * through Lawrence Berkeley National Laboratory (subject to receipt of any
4  * required approvals from the U.S. Dept. of Energy).  All rights reserved.
5  *
6  * This code is distributed under a BSD style license, see the LICENSE file
7  * for complete information.
8  */
9 
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <sys/time.h>
13 
14 #include "timer.h"
15 
16 int
17 main(int argc, char **argv)
18 {
19     struct timer *tp;
20     tp = new_timer(3, 0);
21 
22     sleep(2);
23 
24     if (tp->expired(tp))
25     {
26 	printf("timer should not have expired\n");
27 	exit(-1);
28     }
29     sleep(1);
30 
31     if (!tp->expired(tp))
32     {
33 	printf("timer should have expired\n");
34 	exit(-2);
35     }
36     exit(0);
37 }
38