Hi,
so the latest attempt sees me trying to create an xml file with the lua code in:
[code] function isBST()
local v_time = os.date ("*t", os.time {year=2018, month=3, day=10})
local v_dst = (v_time.isdst)
if v_dst then
return 1
else
return 0
end
end[/code]
This compiles ok, and can be called from the test luup code:
[code]function kwikLog(message, clear)
local socket = require(“socket”)
local time = socket.gettime() or os.time()
local tms = string.format(“.%03d “,math.floor (1000 * (time % 1)))
local stamp = os.date(”%d %b %Y %T”,math.floor(time)) … tms
local mode = “a+”
if clear then mode = “w+” end
local file = io.open(“/www/kwikLog.txt”, mode)
file:write(stamp … (message or “”) … “\n”)
file:close()
end
local t1 = os.date (“*t”, os.time {year=2018, month=3, day=10})
local t2 = os.date (“*t”, os.time {year=2018, month=3, day=25})
local bst=isBST
if bst==0 then
kwikLog(" bst value is false")
– return 0
else
kwikLog(" bst value is true")
– return 1
end
if (t1.isdst) then
kwikLog (" t1 dst true")
else
kwikLog (" t1 dst false")
end
if t2.isdst then
kwikLog (“t2.isdst true”)
else
kwikLog (“t2.isdst false”)
end[/code]
So, I’ve got the function isBST hardcoded, to 10th March 2018 (which is definitely in GMT, not BST), and local variables t1 and t2 hard coded within the test script.
Now, when the function is called, it doesn’t appear to matter what date is hard coded, it always returns true. However when the test code is run t1 returns false, and t2 returns true (as expected). Why does the function handle this differently?
13 Mar 2018 22:30:44.036 bst value is true
13 Mar 2018 22:30:44.040 t1 dst false
13 Mar 2018 22:30:44.044 t2.isdst true
bst value should match with t1 
Thanks
Tony