[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: os.time() and timezones
- From: Egil Hjelmeland <privat@...>
- Date: Mon, 16 Apr 2012 12:47:54 +0200
Den 2012-04-13 10:16, skrev Rena:
Does Lua provide a way to turn a table into a Unix timestamp
under the assumption that the table specifies GMT, not the local
timezone?
If you can assume unix time, the following seem to work:
local epoch = {year=1970, month=1, day=1, hour=0, min=0, sec=0,
isdst=false }
function gmtime(t)
t.isdst = false
return os.time(t) - os.time(epoch)
end
For os.time(t) I found that t.isdst=false means force 'no DST', while
t.isdst=nil means assume DST as known for that day. Perhaps a note in
the Lua reference manual would be good?
BR
egil