Ensure timestamp does not vary with timezone. (#2982)

This commit is contained in:
Chris Lamb 2019-10-18 22:08:16 +01:00 committed by Steven Perron
parent 6a9be627c7
commit e8c3f9b0b4

View File

@ -119,7 +119,7 @@ def describe(directory):
# clock time with enviornment variable SOURCE_DATE_EPOCH
# containing a (presumably) fixed timestamp.
timestamp = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
formatted = datetime.date.fromtimestamp(timestamp).isoformat()
formatted = datetime.datetime.utcfromtimestamp(timestamp).isoformat()
return 'unknown hash, {}'.format(formatted)