7 This file is part of avahi.
9 avahi is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
14 avahi is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
17 Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with avahi; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 /** \file timeval.h Functions to facilitate timeval handling */
30 #include <avahi-common/cdecl.h>
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 /** A numeric data type for storing microsecond values. (signed 64bit integer) */
37 typedef int64_t AvahiUsec;
39 /** Compare two timeval structures and return a ngeative value when a < b, 0 when a == b and a positive value otherwise */
40 int avahi_timeval_compare(const struct timeval *a, const struct timeval *b);
42 /** Calculate the difference between to timeval structures as microsecond value */
43 AvahiUsec avahi_timeval_diff(const struct timeval *a, const struct timeval *b);
45 /** Add a number of microseconds to the specified timeval structure and return it. *a is modified. */
46 struct timeval* avahi_timeval_add(struct timeval *a, AvahiUsec usec);
48 /** Return the difference between the current time and *a. Positive if *a was earlier */
49 AvahiUsec avahi_age(const struct timeval *a);
51 /** Fill *tv with the current time plus "ms" milliseconds plus an
52 * extra jitter of "j" milliseconds. Pass 0 for j if you don't want
54 struct timeval *avahi_elapse_time(struct timeval *tv, unsigned ms, unsigned j);
56 #ifndef DOXYGEN_SHOULD_SKIP_THIS