Module:Time/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 358:
local args = getArgs (frame);
local utc_timestamp, timestamp; -- current or time timestamps; timestamp is local ST or DST time used in output
local tz_abbr; -- select ST or DST timezone abbreviaion used in output
local time_string; -- holds output time/date in |df= format
local utc_offset; -- true when southern hemisphere
local is_dst; -- wether or not dst is active
local data = 'Module:Time/data'..set_sandbox(frame) -- make a data module name; sandbox or live
data = mw.loadData (data); -- load the data module
cfg = data.cfg; -- get the configuration table
local formats = data.formats;
local tz_aliases = {}
local aliases_table = data.tz_aliases; -- get the aliases table
Line 382 ⟶ 377:
args[1] = 'utc'; -- default to utc
end
 
 
tz = tz_aliases[args[1]] and tz_data[tz_aliases[args[1]]] or tz_data[args[1]]; -- make a local copy of the timezone table from tz_data{}
Line 390 ⟶ 384:
end
 
utc_timestamptimestamp = os.time () + get_utc_offset (); -- getmake current serverlocal time (UTC)timestamp
 
utc_offset = get_utc_offset (); -- utc offset for specified timezone in seconds
timestamp = utc_timestamp + utc_offset; -- make local time timestamp
return is_dst_active(timestamp,utc_timestamp) -- set is_dst to 0 or 1
end
 
Line 567 ⟶ 558:
]]
 
return {time = time},
dst_active = dst_active,
}