util.datetime: Fix so that the timestamp returned is always in UTC, timezone offsets were going in the wrong direction

Sat, 27 Nov 2010 01:30:56 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 27 Nov 2010 01:30:56 +0000
changeset 3643
2dc342a13f35
parent 3642
ed80c4c56b9c
child 3644
22fc2063b824

util.datetime: Fix so that the timestamp returned is always in UTC, timezone offsets were going in the wrong direction

util/datetime.lua file | annotate | diff | comparison | revisions
--- a/util/datetime.lua	Sat Nov 27 01:22:43 2010 +0000
+++ b/util/datetime.lua	Sat Nov 27 01:30:56 2010 +0000
@@ -48,7 +48,7 @@
 				tzd_offset = h * 60 * 60 + m * 60;
 				if sign == "-" then tzd_offset = -tzd_offset; end
 			end
-			sec = sec + time_offset + tzd_offset;
+			sec = (sec + time_offset) - tzd_offset;
 			return os_time({year=year, month=month, day=day, hour=hour, min=min, sec=sec});
 		end
 	end

mercurial