-- LUA Date Time example V0.1
--
-- Writes date time stamp at beginning end plus CPU secs used
-- adapted from LUA online doc 22.1 Date and Time
-- http://www.lua.org/pil/22.1.html
--
-- by gramps (John McLeod)
-- V0.1 -- September 16, 2012
--
progname = "LUA Date Time example V0.1"
--
-- MAIN stuff
--
-- print program name and date/time stamp at start
print(progname)
-- e.g. "started 01:42:47 PM Sun Sep 16, 2012"
-- see http://www.lua.org/pil/22.1.html for further options
print(os.date("started %I:%M:%S %p %a %b %d, %Y"))
print(os.date("%z")) -- time zone
print("")
--
print("this program demonstrates some Date/Time stuff from online LUA docs")
print("")
--
-- The following is copied directly from the Doc 22.1 page:
--
-- The os.clock function returns the number of seconds of CPU time
-- for the program. Its typical use is to benchmark a piece of code:
--
local x = os.clock()
local s = 0
for i=1,1000 do s = s + i end -- to 100000 in original
print(string.format("elapsed time: %.2f cpu secs\n", os.clock() - x))
--
-- print program name and date/time stamp at end
print(progname)
print(os.date("ended %I:%M:%S %p %a %b %d, %Y"))
print(os.date("%z")) -- time zone
--
-- end LUA Date Time example V0.1
Want to try?
Add to Cookbook!
To download recipes to your cookbook, you need to have the game client running.
LUA Date Time example V0.1
started 01:49:45 PM Sun Sep 16, 2012
Atlantic Daylight Time
this program demonstrates some Date/Time stuff from online LUA docs
elapsed time: 0.03 cpu secs
LUA Date Time example V0.1
ended 01:49:45 PM Sun Sep 16, 2012