6. The Datetime library
The datetime library date and time manipulation facilities
6.1. Squirrel API
6.1.1. Global Symbols
- clock()
returns a float representing the number of seconds elapsed since the start of the process
- date([time[, format]])
returns a table containing a date/time split into the slots:
sec |
Seconds after minute (0 - 59). |
min |
Minutes after hour (0 - 59). |
hour |
Hours since midnight (0 - 23). |
day |
Day of month (1 - 31). |
month |
Month (0 - 11; January = 0). |
year |
Year (current year). |
wday |
Day of week (0 - 6; Sunday = 0). |
yday |
Day of year (0 - 365; January 1 = 0). |
if time is omitted the current time is used.
if format can be ‘l’ local time or ‘u’ UTC time, if omitted is defaulted as ‘l’(local time).
- time()
returns the number of seconds elapsed since midnight 00:00:00, January 1, 1970.
the result of this function can be formatted through the function date()
6.2. C API
-
SQRESULT sqstd_register_datetimelib(HSQUIRRELVM v)
- Parameters
v (HSQUIRRELVM) – the target VM
- Returns
an SQRESULT
- Remarks
The function expects a table on top of the stack where to register the global library functions.
initialize and register the datetime library in the given VM.