Module:Time/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 557:
local utc_timestamp = os.time (); -- get current server time (UTC) in seconds; used to determine when dst adjustment should be applied
 
local utc_offsettimestamp = utc_timestamp + get_utc_offset (); -- utcmake offsetlocal fortime specified timezonetimestamp (in seconds)
local retvalutc_offset;
local timestamp = utc_timestamp + utc_offset; -- make local time timestamp (in seconds)
local retval;
 
if is_set (tz.dst_begins) and is_set (tz.dst_ends) and is_set (tz.dst_time) then -- make sure we have all of the parts
Line 570 ⟶ 569:
if invert then -- southern hemisphere; use beginning and ending of standard time in the comparison
if utc_timestamp >= dst_end_ts and utc_timestamp < dst_begin_ts then -- is current date time standard time?
retvalutc_offset = tz.utc_offset; -- return timezone-offset from utc
else
retvalutc_offset = apply_dst_ajdust (tz.utc_offset); -- return dst-adjusted timezone-offset from utc
end
else -- northern hemisphere
if utc_timestamp >= dst_begin_ts and utc_timestamp < dst_end_ts then -- is current date time daylight time?
retvalutc_offset = apply_dst_ajdust (tz.utc_offset); -- return dst-adjusted timezone-offset from utc
else
retvalutc_offset = tz.utc_offset; -- return timezone-offset from utc
end
end
Line 586 ⟶ 585:
 
else -- timezone does not use dst
retvalutc_offset = tz.utc_offset; -- return timezone-offset from utc
end
local sign, hours, minutes = retvalutc_offset:match ('^([%-%+]?)(%d%d?):(%d%d)')
if '' == sign then
sign = '+';