33#if _POSIX_TIMERS && !defined(__APPLE__)
37#define COAP_CLOCK CLOCK_REALTIME
40#if defined(HAVE_WINSOCK2_H) && !defined(__MINGW32__)
42gettimeofday(
struct timeval *tp, TIME_ZONE_INFORMATION *tzp) {
44 static const uint64_t s_tUnixEpoch = 116444736000000000Ui64;
48 uint64_t tUsSinceUnicEpoch;
50 GetSystemTimeAsFileTime(&file_time);
51 time.LowPart = file_time.dwLowDateTime;
52 time.HighPart = file_time.dwHighDateTime;
53 tUsSinceUnicEpoch = (time.QuadPart - s_tUnixEpoch) / 10;
55 tp->tv_sec = (long)(tUsSinceUnicEpoch / 1000000);
56 tp->tv_usec = (long)(tUsSinceUnicEpoch % 1000000);
65 clock_gettime(COAP_CLOCK, &tv);
68 gettimeofday(&tv, NULL);
71 coap_clock_offset = tv.tv_sec;
75#define Q(frac,fval) ((1 << (frac)) * (fval))
81#define SHR_FP(val,frac) (((coap_tick_t)((val) + (1 << ((frac) - 1)))) >> (frac))
89 clock_gettime(COAP_CLOCK, &tv);
101 gettimeofday(&tv, NULL);
141#pragma GCC diagnostic ignored "-Wunused-function"
Pulls together all the internal only header files.
#define SHR_FP(val, frac)
#define Q(frac, fval)
creates a Qx.frac from fval in coap_fixed_point_t
COAP_STATIC_INLINE void dummy(void)
coap_tick_t coap_ticks_from_rt_us(uint64_t t)
Helper function that converts POSIX wallclock time in us to coap ticks.
time_t coap_time_t
CoAP time in seconds since epoch.
void coap_clock_init(void)
Initializes the internal clock.
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
coap_time_t coap_ticks_to_rt(coap_tick_t t)
Helper function that converts coap ticks to wallclock time.
#define COAP_TICKS_PER_SECOND
Use ms resolution on POSIX systems.
uint64_t coap_ticks_to_rt_us(coap_tick_t t)
Helper function that converts coap ticks to POSIX wallclock time in us.
void coap_ticks(coap_tick_t *)
Returns the current value of an internal tick counter.
#define COAP_STATIC_INLINE