aboutsummaryrefslogtreecommitdiff
path: root/src/lib/mhd_mono_clock.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/mhd_mono_clock.h')
-rw-r--r--src/lib/mhd_mono_clock.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/lib/mhd_mono_clock.h b/src/lib/mhd_mono_clock.h
new file mode 100644
index 00000000..f4722af2
--- /dev/null
+++ b/src/lib/mhd_mono_clock.h
@@ -0,0 +1,60 @@
1/*
2 This file is part of libmicrohttpd
3 Copyright (C) 2015 Karlson2k (Evgeny Grin)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20/**
21 * @file microhttpd/mhd_mono_clock.h
22 * @brief internal monotonic clock functions declarations
23 * @author Karlson2k (Evgeny Grin)
24 */
25
26#ifndef MHD_MONO_CLOCK_H
27#define MHD_MONO_CLOCK_H 1
28#include "mhd_options.h"
29
30#if defined(HAVE_TIME_H)
31#include <time.h>
32#elif defined(HAVE_SYS_TYPES_H)
33#include <sys/types.h>
34#endif
35
36/**
37 * Initialise monotonic seconds counter.
38 */
39void
40MHD_monotonic_sec_counter_init(void);
41
42
43/**
44 * Deinitialise monotonic seconds counter by freeing any allocated resources
45 */
46void
47MHD_monotonic_sec_counter_finish(void);
48
49
50/**
51 * Monotonic seconds counter, useful for timeout calculation.
52 * Tries to be not affected by manually setting the system real time
53 * clock or adjustments by NTP synchronization.
54 *
55 * @return number of seconds from some fixed moment
56 */
57time_t
58MHD_monotonic_sec_counter(void);
59
60#endif /* MHD_MONO_CLOCK_H */