[pmg-devel] [PATCH v3 pmg-api] MailTracker: remove timezone offset

Mira Limbeck m.limbeck at proxmox.com
Tue Feb 20 11:06:49 CET 2024


The timezone offset is moved to `pmg-log-tracker` in the
compatibility code path. This way the new rfc3339 timestamp, which is
already in UTC, can be used as is.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
v3:
 - no changes

v2:
 - no changes


 src/PMG/API2/MailTracker.pm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/PMG/API2/MailTracker.pm b/src/PMG/API2/MailTracker.pm
index b8b25ad..ffda4b5 100644
--- a/src/PMG/API2/MailTracker.pm
+++ b/src/PMG/API2/MailTracker.pm
@@ -43,8 +43,6 @@ my $run_pmg_log_tracker = sub {
 
     my $logids = {};
 
-    my $timezone = tz_local_offset();;
-
     if (defined(my $id = $includelog)) {
 	if ($id =~ m/^Q([a-f0-9]+)R([a-f0-9]+)$/i) {
 	    $logids->{$1} = 1;
@@ -128,7 +126,7 @@ my $run_pmg_log_tracker = sub {
 	    } elsif ($line =~ m/^TO:([0-9A-F]+):([0-9A-F]+):([0-9A-Z]):\s+from <([^>]*)>\s+to\s+<([^>]+)>\s+\((\S+)\)$/) {
 		my $new = {
 		    size => $entry->{size} // 0,
-		    time => hex($1) - $timezone,
+		    time => hex($1),
 		    qid => $2,
 		    dstatus => $3,
 		    from => $4,
@@ -174,7 +172,7 @@ my $run_pmg_log_tracker = sub {
 	    } elsif ($line =~ m/^TO:([0-9A-F]+):(T[0-9A-F]+L[0-9A-F]+):([0-9A-Z]):\s+from <([^>]*)>\s+to\s+<([^>]*)>$/) {
 		my $e = {};
 		$e->{client} = $entry->{client} if defined($entry->{client});
-		$e->{time} = hex($1) - $timezone;
+		$e->{time} = hex($1);
 		$e->{id} = $2;
 		$e->{dstatus} = $3;
 		$e->{from} = $4;
-- 
2.39.2




More information about the pmg-devel mailing list