Created
February 21, 2017 14:52
-
-
Save luastoned/c820a5c1da76793c11d2f1acf2b28e22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require("ffi") | |
ffi.cdef([[ | |
int QueryPerformanceCounter(int64_t *lpPerformanceCount); | |
int QueryPerformanceFrequency(int64_t *lpFrequency); | |
]]) | |
local function QueryPerformanceCounter(int64) | |
int64 = int64 or ffi.new("int64_t[1]") | |
ffi.C.QueryPerformanceCounter(int64) | |
return tonumber(int64[0]) | |
end | |
local function QueryPerformanceFrequency(int64) | |
int64 = int64 or ffi.new("int64_t[1]") | |
ffi.C.QueryPerformanceFrequency(int64) | |
return tonumber(int64[0]) | |
end | |
return { | |
QueryPerformanceCounter = QueryPerformanceCounter, | |
QueryPerformanceFrequency = QueryPerformanceFrequency, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment