git.py: Parse timestamps from UTC, not from local time
The current parsing of dates from git incorrectly uses datetime.fromtimestamp(), which returns the *local* date and time corresponding to the given timestamp. Instead, it should be using datetime.utcfromtimestamp() which returns the UTC date and time, as the rest of the code expects. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This commit is contained in:
parent
47d500715a
commit
7898b2becd
2
git.py
2
git.py
@ -452,7 +452,7 @@ class Date:
|
|||||||
def __init__(self, epoch, tz):
|
def __init__(self, epoch, tz):
|
||||||
self.epoch = int(epoch)
|
self.epoch = int(epoch)
|
||||||
self.tz = tz
|
self.tz = tz
|
||||||
self.utc = datetime.datetime.fromtimestamp(self.epoch)
|
self.utc = datetime.datetime.utcfromtimestamp(self.epoch)
|
||||||
|
|
||||||
self.tz_sec_offset_min = int(tz[1:3]) * 60 + int(tz[4:])
|
self.tz_sec_offset_min = int(tz[1:3]) * 60 + int(tz[4:])
|
||||||
if tz[0] == '-':
|
if tz[0] == '-':
|
||||||
|
Loading…
Reference in New Issue
Block a user