25.03.2021, 01:54
I'll answer my own question... After experimentation, the answer is to just force ISDST to be FALSE for all timestamps in the first function.., which then always matches the content of the JSON feed, because they are only ever provided in UTC... I was mixing up DST and timezone offsets, which are different things...
This works for me now:
This works for me now:
Code:
local time_string_before_DST = "2021-03-27T06:00:00Z"
-- DST comes into effect in the hours between these two timestamps..
local time_string_after_DST = "2021-03-28T06:00:00Z"
function conv_to_timestamp(string_to_convert)
pattern="(%d+)%-(%d+)%-(%d+)%a(%d+)%:(%d+)%:(%d+)(%u)"
-- execute a match
m_year,m_month,m_day,m_hour,m_min,m_sec,m_zone = string_to_convert:match(pattern)
--log(m_day,m_month,m_year,m_hour,m_min,m_sec,m_zone)
local calculated_timestamp=(os.time{year=m_year, month=m_month, day=m_day, hour=m_hour, min=m_min , sec=m_sec, isdst=false}) -- add isdst=false here
return calculated_timestamp
end
local time_stamp_before_DST = conv_to_timestamp(time_string_before_DST)
local time_stamp_after_DST = conv_to_timestamp(time_string_after_DST)
log("time_stamp_before_DST is: " .. time_stamp_before_DST) -- This outputs 1616824800, which is epoch for 27-03-2021 06:00:00, so is fine
log("time_stamp_after_DST is: " .. time_stamp_after_DST) -- This outputs 1616911200, which is epoch for 28-03-2021 06:00:00, so is fine