18#if !defined(WITH_LWIP) && !defined(WITH_CONTIKI) && !defined(RIOT_VERSION)
39#if _POSIX_TIMERS && !defined(__APPLE__) && !defined(__MINGW32__)
43#define COAP_CLOCK CLOCK_REALTIME
46#if defined(HAVE_WINSOCK2_H) && !defined(__MINGW32__)
48gettimeofday(
struct timeval *tp, TIME_ZONE_INFORMATION *tzp) {
50 static const uint64_t s_tUnixEpoch = 116444736000000000Ui64;
54 uint64_t tUsSinceUnicEpoch;
56 GetSystemTimeAsFileTime(&file_time);
57 time.LowPart = file_time.dwLowDateTime;
58 time.HighPart = file_time.dwHighDateTime;
59 tUsSinceUnicEpoch = (time.QuadPart - s_tUnixEpoch) / 10;
61 tp->tv_sec = (long)(tUsSinceUnicEpoch / 1000000);
62 tp->tv_usec = (long)(tUsSinceUnicEpoch % 1000000);
71 clock_gettime(COAP_CLOCK, &tv);
74 gettimeofday(&tv, NULL);
81#define Q(frac,fval) ((1 << (frac)) * (fval))
87#define SHR_FP(val,frac) (((coap_tick_t)((val) + (1 << ((frac) - 1)))) >> (frac))
95 clock_gettime(COAP_CLOCK, &tv);
107 gettimeofday(&tv, NULL);
147#pragma GCC diagnostic ignored "-Wunused-function"
Library specific build wrapper for coap_internal.h.
#define SHR_FP(val, frac)
static coap_tick_t coap_clock_offset
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 *t)
Returns the current value of an internal tick counter.
#define COAP_STATIC_INLINE