20 #if defined(_WIN32) || defined(_WIN64) 30 #if defined(_WIN32) || defined(_WIN64) 31 Sleep((DWORD)milliseconds);
33 usleep((useconds_t)(milliseconds*1000));
38 #if defined(_WIN32) || defined(_WIN64) 41 #if WINVER >= _WIN32_WINNT_VISTA 42 return GetTickCount64();
44 return GetTickCount();
50 static struct timespec start;
51 clock_gettime(CLOCK_MONOTONIC, &start);
57 static struct timeval start;
58 static struct timespec start_ts;
60 clock_gettime(CLOCK_MONOTONIC, &start_ts);
61 start.tv_sec = start_ts.tv_sec;
62 start.tv_usec = start_ts.tv_nsec / 1000;
72 #if defined(_WIN32) || defined(_WIN64) 80 #if WINVER >= _WIN32_WINNT_VISTA 93 struct timespec result;
95 ntimersub(
new, old, result);
96 return (
DIFF_TIME_TYPE)((result.tv_sec)*1000L + (result.tv_nsec)/1000000L);
101 struct timeval result;
103 timersub(&
new, &old, &result);
DIFF_TIME_TYPE MQTTTime_difftime(START_TIME_TYPE new, START_TIME_TYPE old)
START_TIME_TYPE MQTTTime_start_clock(void)
void MQTTTime_sleep(ELAPSED_TIME_TYPE milliseconds)
START_TIME_TYPE MQTTTime_now(void)
#define ELAPSED_TIME_TYPE
ELAPSED_TIME_TYPE MQTTTime_elapsed(START_TIME_TYPE milliseconds)