# HG changeset patch # User Kim Alvefur # Date 1431910001 -7200 # Node ID ec50cecc9318795097e8914075369f0a1aa81275 # Parent 07ceaf5f6f0d2f2f32e8a6646a2d6d4f50827379 mod_storage_xmlarchive: Store timestamps in text form, I don't trust numeric timestamps in Lua diff -r 07ceaf5f6f0d -r ec50cecc9318 mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon May 18 02:45:49 2015 +0200 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon May 18 02:46:41 2015 +0200 @@ -50,7 +50,7 @@ ok, err = f:close(); if not ok then return nil, err; end local id = day .. "-" .. hmac_sha256(username.."@"..day.."+"..offset, data, true):sub(-16); - ok, err = dm.list_append(username.."@"..day, module.host, self.store, { id = id, when = when, with = with, offset = offset, length = #data }); + ok, err = dm.list_append(username.."@"..day, module.host, self.store, { id = id, when = dt.datetime(when), with = with, offset = offset, length = #data }); if not ok then return nil, err; end return id; end @@ -133,6 +133,13 @@ for i = first_item, last_item, step do local item = items[i]; local i_when, i_with = item.when, item.with; + if type(i_when) == "string" then + i_when = dt.parse(i_when); + end + if type(i_when) ~= "number" then + module:log("warn", "data[%q][%d].when is invalid", dates[d], i); + break; + end if not item then module:log("warn", "data[%q][%d] is nil", dates[d], i); break;