Skip to content

Commit 526544f

Browse files
committed
fix get_time on linux
1 parent 2708fe5 commit 526544f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

test/helpers/get_time.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ else
3434
ffi.cdef([[
3535
int clock_gettime(int clock_id, void *tp);
3636
]])
37-
local ts = ffi.new("struct { long int tv_sec; long int tv_nsec; }")
38-
local enum = 1
37+
local ts = ffi.new("struct { long int tv_sec; long int tv_nsec; }[1]")
3938
local func = ffi.C.clock_gettime
4039
return function()
41-
func(enum, ts)
42-
return tonumber(ts.tv_sec) + tonumber(ts.tv_nsec) * 0.000000001
40+
func(1, ts)
41+
return tonumber(ts[0].tv_sec) + tonumber(ts[0].tv_nsec) * 0.000000001
4342
end
4443
end

0 commit comments

Comments
 (0)