mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix timezone handling for rpm installtime
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.
This commit is contained in:
parent
d906e8fadb
commit
c7da9f87b6
1 changed files with 1 additions and 1 deletions
|
@ -575,7 +575,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
|
||||
|
|
Loading…
Add table
Reference in a new issue