mhd_mono_clock.h (2013B)
1 /* 2 This file is part of libmicrohttpd 3 Copyright (C) 2015-2021 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 #include <stdint.h> 36 37 /** 38 * Initialise monotonic seconds and milliseconds counters. 39 */ 40 void 41 MHD_monotonic_sec_counter_init (void); 42 43 44 /** 45 * Deinitialise monotonic seconds and milliseconds counters by freeing 46 * any allocated resources 47 */ 48 void 49 MHD_monotonic_sec_counter_finish (void); 50 51 52 /** 53 * Monotonic seconds counter. 54 * Tries to be not affected by manually setting the system real time 55 * clock or adjustments by NTP synchronization. 56 * 57 * @return number of seconds from some fixed moment 58 */ 59 time_t 60 MHD_monotonic_sec_counter (void); 61 62 63 /** 64 * Monotonic milliseconds counter, useful for timeout calculation. 65 * Tries to be not affected by manually setting the system real time 66 * clock or adjustments by NTP synchronization. 67 * 68 * @return number of microseconds from some fixed moment 69 */ 70 uint64_t 71 MHD_monotonic_msec_counter (void); 72 73 #endif /* MHD_MONO_CLOCK_H */