Code: Select all
function timeDiff(dName,dType)
if dType == 'v' then
updTime = uservariables_lastupdate[dName]
elseif dType == 'd' then
updTime = otherdevices_lastupdate[dName]
end
t1 = os.time()
year = string.sub(updTime, 1, 4)
month = string.sub(updTime, 6, 7)
days = string.sub(updTime, 9, 10)
hour = string.sub(updTime, 12, 13)
minutes = string.sub(updTime, 15, 16)
seconds = string.sub(updTime, 18, 19)
t2 = os.time{year=year, month=month, day=days, hour=hour, min=minutes, sec=seconds}
tDiff = os.difftime(t1,t2)
return tDiff
end
Code: Select all
t2 = os.time{year=year, month=month, day=days, hour=hour, min=minutes, sec=seconds}
field 'day' missing in date table