mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 18:46:43 +00:00
Add timer.now() to get current time in milliseconds (UTC)
This commit is contained in:
parent
ffa223b5b3
commit
392c1b9aca
1 changed files with 15 additions and 0 deletions
|
@ -15,6 +15,11 @@ class Timer : IPlugin
|
||||||
name = "start",
|
name = "start",
|
||||||
function = L_StartTimer,
|
function = L_StartTimer,
|
||||||
},
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
name = "now",
|
||||||
|
function = L_Now
|
||||||
|
},
|
||||||
|
|
||||||
new(),
|
new(),
|
||||||
};
|
};
|
||||||
|
@ -82,4 +87,14 @@ class Timer : IPlugin
|
||||||
L.PushInteger(timerId);
|
L.PushInteger(timerId);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int L_Now(IntPtr state)
|
||||||
|
{
|
||||||
|
var now = DateTimeOffset.UtcNow;
|
||||||
|
var L = Lua.FromIntPtr(state);
|
||||||
|
|
||||||
|
L.PushInteger(now.ToUnixTimeMilliseconds());
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue