os.time

Returns the current time or calculates the time in seconds from a table

Prototype

time = os.time (t)

Description

Returns the current time if no argument supplied. The time is in seconds from the start of the current epoch.

On Windows, the function returns the number of seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time, according to the system clock.

If an argument is supplied it must be a table with at least the entries: The table can also have the entries: This table can be produced by calling: os.date ("*t")

print (os.time { year = 2004, month = 8, 
                 day = 30, hour = 6, min = 32, sec = 1, dst = true }) --> 1093811521
print (os.date ("%x %X", 1093811521))  --> 30/08/04 06:32:01                 

Lua functions

Topics