Module:Sandbox5

local p = {} function p.conditions local hour, hourcvt local tzloctime local result hour = tonumber(os.date('%H')) --   tzloctime = tonumber(os.time) something ridiculous like nanosecs... tzloctime = os.date('%z') -- hack... hourcvt = (hour - 7) % 24 hour = hourcvt -- hack... if hour < 6 then result = 'Good night!' elseif hour < 12 then result = 'Good morning!' elseif hour < 18 then result = 'Good afternoon!' else result = 'Good evening!' end

result = result .. tzoffset .. 'or...' .. tzloctime result = result .. '\nactual=' .. hourcvt .. ' o-clock.\n' return result end -- see:http://lua-users.org/wiki/TimeZone -- Compute the difference in seconds between local time and UTC. local function get_timezone local now = os.time return os.difftime(now, os.time(os.date("!*t", now))) end timezone = get_timezone

-- Return a timezone string in ISO 8601:2000 standard form (+hhmm or -hhmm) local function get_tzoffset(timezone) local h, m = math.modf(timezone / 3600) return string.format("%+.4d", 100 * h + 60 * m) end tzoffset = get_tzoffset(timezone) return p