fix time zone in crash.py

This commit is contained in:
shenjack 2023-07-16 00:20:11 +08:00
parent d57da4c7ff
commit 2155ad7045
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -77,7 +77,7 @@ def create_crash_report(info: Optional[str] = None) -> None:
crash_info = crash_info_handler(info)
if 'crash_report' not in os.listdir('./'):
os.mkdir('./crash_report')
date_time = time.strftime('%Y-%m-%d %H-%M-%S', time.gmtime(time.time()))
date_time = time.strftime('%Y-%m-%d %H-%M-%S', time.localtime())
filename = f'crash-{date_time}.md'
cache_stream = io.StringIO()
try:
@ -92,7 +92,7 @@ def create_crash_report(info: Optional[str] = None) -> None:
def write_cache(cache_stream, crash_info):
# 开头信息
cache_stream.write(Head_message.format(now_time=time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(time.time()))))
cache_stream.write(Head_message.format(now_time=time.strftime('%Y/%m/%d %H:%M:%S', time.localtime())))
# 崩溃信息
cache_stream.write(crash_info)