PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

os

The os library currently serves the purpose of providing information about the system time, under the UTC format.
It has been heavily sandboxed from the standard Lua os library, and does not allow you to perform any system altering operations.

int os.time ( )

Returns how many seconds have elapsed since the UNIX epoch (1 January 1970, 00:00:00), under UTC time.

int os.difftime ( int t2, int t1 )

Returns the number of seconds from t1 to t2. The difference is computed assuming that t1 and t2 are correctly casted to the time_t format.

dictionary os.date ( string formatString, int time )

Returns a table containing the components (year, hour, etc.) of the date. The formatString must be either "*t" or "!*t", and time is the same as the return value of os.time(), defaulting to now.

The returned dictionary contains the following data:

Field Type Description
year int An integer that describes the current year of the Current Era (ex. 2017)
month int An integer between 1 and 12 (starting from January) that describes the current month.
wday int An integer between 1 and 7 (starting from Sunday) that describes the current week day.
yday int An integer between 1 and 366 describing how many days we are into the year.
There can be 366 days if it is a leap year.
day int An integer between 1 and 31 describing the current day of the month.
hour int An integer between 1 and 24 describing the current hour of the day.
min int An integer between 0 and 59 describing the current minute of the hour.
sec int An integer between 0 and 60 describing the current second of the hour.
(60 because the function is described to indicate leap seconds, but in practice it probably doesn't).
isdst bool A boolean describing if daylight savings time is currently active.