Millisecs
This function returns the system time in milliseconds. Unlike the Leadwerks::Time::GetCurrent() function, this value updates continuously and is not affected by calls to Leadwerks::Time::Pause() and Leadwerks::Time::Resume().
Syntax
Returns
Returns the system time.
Example
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
local camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)
model = Model:Box()
model:SetColor(0.0,0.0,1.0)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
--Press the space key pause and resume timing
if (window:KeyHit(Key.Space)) then
paused = not paused
if (paused) then
Time:Pause()
else
Time:Resume()
end
end
model:Turn(0,Time:GetSpeed(),0)
Time:Update()
world:Update()
world:Render()
context:SetBlendMode(Blend.Alpha)
context:DrawText("Time: "..Time:GetCurrent(),2,2)
context:DrawText("Millisecs: "..Time:Millisecs(),2,22)
context:Sync()
end