API time

From Wowpedia
Jump to: navigation, search

Returns a timestamp value for the specified or current time.

timestamp = time([dateTable])

This function is Lua's standard os.time, shifted into the global namespace.

Arguments

dateTable 
Optional Table - Table specifying a date/time to return the timestamp of; if omitted, a timestamp for the current time (per the local clock) will be returned. This table must have fields year, month, and day, and may have fields hour, min, sec, and isdst. For a description of these fields, see the Lua reference manual.

Returns

timestamp 
Number - A number representing the time as a number of seconds since the epoch.

Example

/run print("Current Time: " .. time())

Might produce:

Current Time: 1118722038

Notes

  • If not given any arguments, time() will return a value based on the local clock, so it is not synchronized among clients.
  • Consider using GetServerTime instead if you would rather have a value based on the server clock, which IS synchronized among clients.

See also