From: Vsevolod Stakhov Date: Sun, 8 May 2022 11:09:52 +0000 (+0100) Subject: [Fix] Dmarc report: Use local timezone instead of GMT X-Git-Tag: 3.3~263 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c6a5be1c1d08b4e4948a215a27c6406b51f48c8a;p=rspamd.git [Fix] Dmarc report: Use local timezone instead of GMT --- diff --git a/lualib/rspamadm/dmarc_report.lua b/lualib/rspamadm/dmarc_report.lua index c87a2c00e..ad727d177 100644 --- a/lualib/rspamadm/dmarc_report.lua +++ b/lualib/rspamadm/dmarc_report.lua @@ -621,7 +621,7 @@ end -- Returns a day before today at 00:00 as unix seconds local function yesterday_midnight() - local piecewise_time = os.date("!*t") + local piecewise_time = os.date("*t") piecewise_time.day = piecewise_time.day - 1 -- Lua allows negative values here piecewise_time.hour = 0 piecewise_time.sec = 0 @@ -631,7 +631,7 @@ end -- Returns today time at 00:00 as unix seconds local function today_midnight() - local piecewise_time = os.date("!*t") + local piecewise_time = os.date("*t") piecewise_time.hour = 0 piecewise_time.sec = 0 piecewise_time.min = 0 @@ -688,7 +688,7 @@ local function handler(args) if not opts.date or #opts.date == 0 then opts.date = {} - table.insert(opts.date, os.date('!%Y%m%d', yesterday_midnight())) + table.insert(opts.date, os.date('%Y%m%d', yesterday_midnight())) end local ndates = 0 diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index 79a1826d4..2d00bad10 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -304,8 +304,8 @@ local function dmarc_validate_policy(task, policy, hdrfromdom, dmarc_esld) end -- Prepare and send redis report element - local period = os.date('!%Y%m%d', - task:get_date({format = 'connect', gmt = true})) + local period = os.date('%Y%m%d', + task:get_date({format = 'connect', gmt = false})) -- Dmarc domain key must include dmarc domain, rua and period local dmarc_domain_key = table.concat(