Skip to content

Instantly share code, notes, and snippets.

@truemedian
truemedian / clock_gettime.lua
Last active April 17, 2021 21:18
Windows / Posix compatible clock_gettime(REALTIME) ffi bindings.
local ffi = require 'ffi'
local bit = require 'bit'
local clock_gettime
if ffi.os == 'Windows' then
local UNIX_TIME_START = 0x019DB1DED53E8000LL
local TICKS_PER_SECOND = 10000000LL
ffi.cdef [[