xref: /iperf/src/iperf_time.h (revision cde81d76)
1*cde81d76SBen Fox-Moore /*
2*cde81d76SBen Fox-Moore  * iperf, Copyright (c) 2014-2018, The Regents of the University of
3*cde81d76SBen Fox-Moore  * California, through Lawrence Berkeley National Laboratory (subject
4*cde81d76SBen Fox-Moore  * to receipt of any required approvals from the U.S. Dept. of
5*cde81d76SBen Fox-Moore  * Energy).  All rights reserved.
6*cde81d76SBen Fox-Moore  *
7*cde81d76SBen Fox-Moore  * If you have questions about your rights to use or distribute this
8*cde81d76SBen Fox-Moore  * software, please contact Berkeley Lab's Technology Transfer
9*cde81d76SBen Fox-Moore  * Department at [email protected].
10*cde81d76SBen Fox-Moore  *
11*cde81d76SBen Fox-Moore  * NOTICE.  This software is owned by the U.S. Department of Energy.
12*cde81d76SBen Fox-Moore  * As such, the U.S. Government has been granted for itself and others
13*cde81d76SBen Fox-Moore  * acting on its behalf a paid-up, nonexclusive, irrevocable,
14*cde81d76SBen Fox-Moore  * worldwide license in the Software to reproduce, prepare derivative
15*cde81d76SBen Fox-Moore  * works, and perform publicly and display publicly.  Beginning five
16*cde81d76SBen Fox-Moore  * (5) years after the date permission to assert copyright is obtained
17*cde81d76SBen Fox-Moore  * from the U.S. Department of Energy, and subject to any subsequent
18*cde81d76SBen Fox-Moore  * five (5) year renewals, the U.S. Government is granted for itself
19*cde81d76SBen Fox-Moore  * and others acting on its behalf a paid-up, nonexclusive,
20*cde81d76SBen Fox-Moore  * irrevocable, worldwide license in the Software to reproduce,
21*cde81d76SBen Fox-Moore  * prepare derivative works, distribute copies to the public, perform
22*cde81d76SBen Fox-Moore  * publicly and display publicly, and to permit others to do so.
23*cde81d76SBen Fox-Moore  *
24*cde81d76SBen Fox-Moore  * This code is distributed under a BSD style license, see the LICENSE
25*cde81d76SBen Fox-Moore  * file for complete information.
26*cde81d76SBen Fox-Moore  */
27*cde81d76SBen Fox-Moore #ifndef __IPERF_TIME_H
28*cde81d76SBen Fox-Moore #define __IPERF_TIME_H
29*cde81d76SBen Fox-Moore 
30*cde81d76SBen Fox-Moore #include <stdint.h>
31*cde81d76SBen Fox-Moore 
32*cde81d76SBen Fox-Moore struct iperf_time {
33*cde81d76SBen Fox-Moore     uint32_t secs;
34*cde81d76SBen Fox-Moore     uint32_t usecs;
35*cde81d76SBen Fox-Moore };
36*cde81d76SBen Fox-Moore 
37*cde81d76SBen Fox-Moore int iperf_time_now(struct iperf_time *time1);
38*cde81d76SBen Fox-Moore 
39*cde81d76SBen Fox-Moore void iperf_time_add_usecs(struct iperf_time *time1, uint64_t usecs);
40*cde81d76SBen Fox-Moore 
41*cde81d76SBen Fox-Moore int iperf_time_compare(struct iperf_time *time1, struct iperf_time *time2);
42*cde81d76SBen Fox-Moore 
43*cde81d76SBen Fox-Moore int iperf_time_diff(struct iperf_time *time1, struct iperf_time *time2, struct iperf_time *diff);
44*cde81d76SBen Fox-Moore 
45*cde81d76SBen Fox-Moore uint64_t iperf_time_in_usecs(struct iperf_time *time);
46*cde81d76SBen Fox-Moore 
47*cde81d76SBen Fox-Moore double iperf_time_in_secs(struct iperf_time *time);
48*cde81d76SBen Fox-Moore 
49*cde81d76SBen Fox-Moore #endif
50