summaryrefslogtreecommitdiff
path: root/examples/win32/platform_utils.c
blob: 59c1956980825a46cac386ef16c369fb49f41d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright 2007 - 2021, Alan Antonuk and the rabbitmq-c contributors.
// SPDX-License-Identifier: mit

#include <stdint.h>

#include <windows.h>

uint64_t now_microseconds(void) {
  FILETIME ft;
  GetSystemTimeAsFileTime(&ft);
  return (((uint64_t)ft.dwHighDateTime << 32) | (uint64_t)ft.dwLowDateTime) /
         10;
}

void microsleep(int usec) { Sleep(usec / 1000); }