File 0045-Fix-timezone-handling-for-rpm-installtime-bsc-101707.patch of Package salt.4663

From bb763ef2bcb1779f2715e9c108040b552f3b3ab8 Mon Sep 17 00:00:00 2001
From: Frantisek Kobzik <fkobzik@suse.de>
Date: Thu, 12 Jan 2017 16:02:47 +0100
Subject: [PATCH 45/45] Fix timezone handling for rpm installtime (bsc#1017078)

Previously datetime.fromtimestamp was used. If used without additional
parameters, this method returns date in the local timezone.

Our code took the result of fromtimestamp, appended 'Z' and returned
this string. This is wrong as 'Z' means UTC (the client code parses this
value as UTC, but it's in fact local time).

Fixed by using utcfromtimestamp.
---
 salt/modules/rpm.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/salt/modules/rpm.py b/salt/modules/rpm.py
index 97dd468b35..045ea460b0 100644
--- a/salt/modules/rpm.py
+++ b/salt/modules/rpm.py
@@ -538,7 +538,7 @@ def info(*packages, **attr):
             # Convert Unix ticks into ISO time format
             if key in ['build_date', 'install_date']:
                 try:
-                    pkg_data[key] = datetime.datetime.fromtimestamp(int(value)).isoformat() + "Z"
+                    pkg_data[key] = datetime.datetime.utcfromtimestamp(int(value)).isoformat() + "Z"
                 except ValueError:
                     log.warning('Could not convert "{0}" into Unix time'.format(value))
                 continue
-- 
2.11.0

openSUSE Build Service is sponsored by