diff --git a/boostjp/templates/content.html b/boostjp/templates/content.html index 9654962..c3c41ef 100644 --- a/boostjp/templates/content.html +++ b/boostjp/templates/content.html @@ -92,8 +92,8 @@ {% if latest_commit_info %}
最終更新日時:
-
- {{ latest_commit_info['last_updated'].strftime('%Y年%m月%d日 %H時%M分%S秒') }}
+
+ {{ latest_commit_info['last_updated'].strftime('%Y年%m月%d日 %H時%M分%S秒') }} (JST)
- 最終更新日時(UTC):
-
- {{ latest_commit_info['last_updated'].strftime('%Y年%m月%d日 %H時%M分%S秒') }}
+ 最終更新日時:
+
+ {{ latest_commit_info['last_updated'].strftime('%Y年%m月%d日 %H時%M分%S秒') }} (JST)
diff --git a/cpprefjp/templates/content.html b/cpprefjp/templates/content.html
index 952f458..7c6949c 100644
--- a/cpprefjp/templates/content.html
+++ b/cpprefjp/templates/content.html
@@ -101,9 +101,9 @@
{% block latest_commit_info %}
{% if latest_commit_info %}
diff --git a/run.py b/run.py
index ea18bee..11c81d7 100755
--- a/run.py
+++ b/run.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-from datetime import datetime
+from datetime import datetime, timedelta, timezone
import glob
import importlib
import json
@@ -469,13 +469,17 @@ def flush(self):
f.write(json.dumps(self._cache))
+_JST = timezone(timedelta(hours=9), 'JST')
+
+
def get_latest_commit_info(path):
commit_log = subprocess.check_output(['git', 'log', '-1', '--date=iso', '--pretty=format:%at %an', path + '.md'], cwd=settings.INPUT_DIR, text=True, errors='ignore')
if not commit_log:
return None
timestamp, author = commit_log.split(' ', 1)
return {
- 'last_updated': datetime.fromtimestamp(int(timestamp)),
+ # git の %at は Unix 時刻 (UTC の瞬間) なので JST に変換して返す。
+ 'last_updated': datetime.fromtimestamp(int(timestamp), _JST),
'last_author': author,
}