Mercurial > prosody-hg
comparison util/datetime.lua @ 3643:2dc342a13f35
util.datetime: Fix so that the timestamp returned is always in UTC, timezone offsets were going in the wrong direction
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 27 Nov 2010 01:30:56 +0000 |
| parents | ed80c4c56b9c |
| children | 7b456af75c77 |
comparison
equal
deleted
inserted
replaced
| 3642:ed80c4c56b9c | 3643:2dc342a13f35 |
|---|---|
| 46 if #m ~= 2 then m = "0"; end | 46 if #m ~= 2 then m = "0"; end |
| 47 h, m = tonumber(h), tonumber(m); | 47 h, m = tonumber(h), tonumber(m); |
| 48 tzd_offset = h * 60 * 60 + m * 60; | 48 tzd_offset = h * 60 * 60 + m * 60; |
| 49 if sign == "-" then tzd_offset = -tzd_offset; end | 49 if sign == "-" then tzd_offset = -tzd_offset; end |
| 50 end | 50 end |
| 51 sec = sec + time_offset + tzd_offset; | 51 sec = (sec + time_offset) - tzd_offset; |
| 52 return os_time({year=year, month=month, day=day, hour=hour, min=min, sec=sec}); | 52 return os_time({year=year, month=month, day=day, hour=hour, min=min, sec=sec}); |
| 53 end | 53 end |
| 54 end | 54 end |
| 55 end | 55 end |
| 56 | 56 |
