changeset 1568:c357039c1ab1

mod_storage_muc_log: Change to sane timestamp format and warn if it differs from legacy mod_muc_log timestamps
author Kim Alvefur <zash@zash.se>
date Mon, 10 Nov 2014 14:51:36 +0100
parents 585bb8ac11bb
children 711fabfe6604
files mod_storage_muc_log/mod_storage_muc_log.lua
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_muc_log/mod_storage_muc_log.lua	Mon Nov 10 14:47:54 2014 +0100
+++ b/mod_storage_muc_log/mod_storage_muc_log.lua	Mon Nov 10 14:51:36 2014 +0100
@@ -8,7 +8,7 @@
 local noop = function () end;
 local os_date = os.date;
 
-local timef, datef = "!%X", "!%y%m%d";
+local timef, datef = "!%H:%M:%S", "!%y%m%d";
 local host = module.host;
 
 local driver = {};
@@ -19,12 +19,15 @@
 	-- Fun fact: 09:00 and 21:00 en_HK are both "09:00:00 UTC"
 	local t = os_date("!*t");
 	t.hour = 9;
-	local am = os_date(timef, os.time(t));
+	local am = os_date("!%X", os.time(t));
 	t.hour = 21;
-	local pm = os_date(timef, os.time(t));
+	local pm = os_date("!%X", os.time(t));
 	if am == pm then
 		module:log("warn", "Timestamps in AM and PM are identical in your locale, expect timestamps to be wrong");
 	end
+	if os_date("!%X", os.time(t)) ~= os_date(timef, os_date(t)) then
+		module:log("warn", "Timestamp format differ from what mod_muc_log used, this module may not work correctly");
+	end
 end
 
 local function parse_silly(date, time)