Skip to content

Commit 2b6841e

Browse files
committed
Fix timestamp generation.
1 parent 8b028d2 commit 2b6841e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/plugins/specs/specs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from git import Git, Repo, InvalidGitRepositoryError
44
import os
55
from datetime import datetime
6-
from time import mktime, altzone
6+
import time
77
from sc import fp, fs
88

99
import locale
@@ -45,15 +45,15 @@ def specs(content):
4545
with_extended_output=True, with_exceptions=False)
4646
if status != 0:
4747
# file is not managed by git
48-
content.updated = datetime.fromtimestamp(os.stat(path).st_mtime)
48+
content.updated = time.gmtime(os.stat(path).st_mtime)
4949
content.gitrev = '(not yet committed)'
5050
else:
5151
commits = repo.commits(path=path)
5252
assert len(commits) > 0
53-
content.updated = datetime.fromtimestamp(mktime(commits[-1].committed_date) - altzone)
54-
content.gitrev = commits[-1].id
53+
content.updated = commits[0].committed_date
54+
content.gitrev = commits[0].id
5555

56-
content.updated = content.updated.strftime('%F %T %z (%a, %d %B %Y)')
56+
content.updated = time.strftime('%F %T UTC (%a, %d %B %Y)', content.updated)
5757

5858
def register():
5959
signals.content_object_init.connect(specs)

0 commit comments

Comments
 (0)