I'm currently trying to get the amount of seconds to epoch time, but for some reason my calculation is exactly 17 hours off in seconds. I can't tell why, so I'm hoping and extra pair of eyes on this will help.
function Date:get_seconds_until_epoch()
local p, result
p = private[self]
if p.year >= 1970 then
result = p.second +
(p.minute * seconds_in.minute) +
(p.hour * seconds_in.hour) +
elapsedDaysInYear(p) * seconds_in.day
for i = 1970, p.year - 1, 1 do
result = result + (isLeapYear(i) and seconds_in.leap_year or seconds_in.year)
end
return result
end```
`seconds_in.minute/hour/day` all return the correct values, and `elapsedDaysInYear` is returning the current elapsed days this year (as of right now thats 183 days).
This is annoying because if it was off by a whole day, I might figure it's the leapYear thing, or some off-by-one error somewhere. But 17 hours? I don't know how that would happen. I was thinking it was my timezone maybe? But my timezone is +8, so that doesn't make any sense. I thought maybe it was daylight savings, but that's only an hour difference. So I can't figure out why it's off by exactly 17 hours.