Register forum user name Search FAQ

os.time

Summary

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:


  • year
  • month
  • day


The table can also have the entries:



  • hour
  • min
  • sec
  • isdst


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                 


See Also ...

Lua functions

os.clock - Amount of elapsed/CPU time used (depending on OS)
os.date - Formats a date/time string
os.difftime - Calculates a time difference in seconds
os.execute - Executes an operating system command
os.exit - Attempts to terminate the process
os.getenv - Returns an operating system environment variable
os.remove - Deletes a file
os.rename - Renames a file
os.setlocale - Sets the current locale to the supplied locale
os.tmpname - Returns a name for a temporary file

Topics

Lua base functions
Lua bc (big number) functions
Lua bit manipulation functions
Lua coroutine functions
Lua debug functions
Lua io functions
Lua math functions
Lua os functions
Lua package functions
Lua PCRE regular expression functions
Lua script extensions
Lua string functions
Lua syntax
Lua table functions
Lua utilities
Scripting
Scripting callbacks - plugins

(Help topic: lua=os.time)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.