Merge pull request #43 from shenjackyuanjie/bugfix/crash-timezone

fix time zone in crash.py
This commit is contained in:
shenjack 2023-07-16 00:33:33 +08:00 committed by GitHub
commit 8e9589e378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)