Time operations are already available in Lua - see http://www.lua.org/manual/5.1/manual.html#pdf-os.difftime.