Talk:love.timer

Is here some way to get time from 1970 in seconds with milliseconds? Like this:

local starting_time = os.time() -- time in seconds

function love.timer.getTime()
	return starting_time + os.clock () -- time in seconds and time from game start
end

function love.draw()
	love.graphics.print(love.timer.getTime(), 32,32)
end

--Darkfrei (talk) 16:32, 24 February 2021 (CET) ‎ socket.gettime() return time in seconds relative to origin of the universe (1 Jan 1970) with microseconds precision

socket = require 'socket'

function love.draw()
	love.graphics.print(('%.4f seconds passed since origin of the universe (1 Jan 1970)'):format(socket.gettime()), 32, 32)
	-- Prints something like: 1614267059.6269 seconds passed since origin of the universe (1 Jan 1970)
	-- string.format is used to fix number of digits after decimal point
end

--Andlac028 (talk) 16:41, 25 February 2021 (CET)