forked from uli/cascade
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathos_win32.cpp
More file actions
37 lines (34 loc) · 794 Bytes
/
os_win32.cpp
File metadata and controls
37 lines (34 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* os_win32.cpp
*
* (C) Copyright 2014 Ulrich Hecht
*
* This file is part of CASCADE. CASCADE is almost free software; you can
* redistribute it and/or modify it under the terms of the Cascade Public
* License 1.0. Read the file "LICENSE" for details.
*/
#include "os.h"
#include <windows.h>
#include "debug.h"
void os_msleep(int ms)
{
Sleep(ms);
}
LARGE_INTEGER freq;
unsigned int os_mtime()
{
static bool have_freq = false;
if (!have_freq) {
if (!QueryPerformanceFrequency(&freq)) {
ERROR("failed to query performance frequency\n");
abort();
}
have_freq = true;
}
LARGE_INTEGER time;
if (!QueryPerformanceCounter(&time)) {
ERROR("failed to query performance counter\n");
abort();
}
return time.QuadPart * 1000 / freq.QuadPart;
}