projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util.ip: Fix protocol detection of IPv6 addresses beginning with : [Backported from...
[prosody.git]
/
util
/
datetime.lua
diff --git
a/util/datetime.lua
b/util/datetime.lua
index 301a49a5e9cd60035d4603919428f6192cd1058c..a1f62a48563ed48fc2d30c5c1f5e8b94c66e0e17 100644
(file)
--- a/
util/datetime.lua
+++ b/
util/datetime.lua
@@
-36,7
+36,7
@@
end
function parse(s)
if s then
local year, month, day, hour, min, sec, tzd;
function parse(s)
if s then
local year, month, day, hour, min, sec, tzd;
- year, month, day, hour, min, sec, tzd = s:match("^(%d%d%d%d)
-?(%d%d)-?(%d%d)T(%d%d):(%d%d):(%d%d)%.?%d*([Z+%-]
.*)$");
+ year, month, day, hour, min, sec, tzd = s:match("^(%d%d%d%d)
%-?(%d%d)%-?(%d%d)T(%d%d):(%d%d):(%d%d)%.?%d*([Z+%-]?
.*)$");
if year then
local time_offset = os_difftime(os_time(os_date("*t")), os_time(os_date("!*t"))); -- to deal with local timezone
local tzd_offset = 0;
if year then
local time_offset = os_difftime(os_time(os_date("*t")), os_time(os_date("!*t"))); -- to deal with local timezone
local tzd_offset = 0;
@@
-49,7
+49,7
@@
function parse(s)
if sign == "-" then tzd_offset = -tzd_offset; end
end
sec = (sec + time_offset) - tzd_offset;
if sign == "-" then tzd_offset = -tzd_offset; end
end
sec = (sec + time_offset) - tzd_offset;
- return os_time({year=year, month=month, day=day, hour=hour, min=min, sec=sec});
+ return os_time({year=year, month=month, day=day, hour=hour, min=min, sec=sec
, isdst=false
});
end
end
end
end
end
end