commit c6a5be1: [Fix] Dmarc report: Use local timezone instead of GMT
Vsevolod Stakhov
vsevolod at rspamd.com
Sun May 8 11:14:04 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-05-08 12:09:52 +0100
URL: https://github.com/rspamd/rspamd/commit/c6a5be1c1d08b4e4948a215a27c6406b51f48c8a (HEAD -> master)
[Fix] Dmarc report: Use local timezone instead of GMT
---
lualib/rspamadm/dmarc_report.lua | 6 +++---
src/plugins/lua/dmarc.lua | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
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(
More information about the Commits
mailing list