v04 update 03

This commit is contained in:
13339479676 2022-01-21 08:53:37 +08:00
parent 9598792780
commit ff413c0d8f
2 changed files with 3 additions and 7 deletions

View File

@ -54,5 +54,5 @@ def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompres
compress_file.close()
compress_endTime = time.time() # 压缩结束时间
compress_totalTime = compress_endTime - compress_startTime
# print(f'文件压缩成功!用时:{time_format(compress_totalTime)},已保存在:{compressName}')
print(f'文件压缩成功!用时:{compress_totalTime:.3f}秒,已保存在:{compressName}')
print(f'文件压缩成功!用时:{time_format(compress_totalTime)},已保存在:{compressName}')
# print(f'文件压缩成功!用时:{compress_totalTime:.3f}秒,已保存在:{compressName}')

View File

@ -1,6 +1,6 @@
# 时间格式化
# 创建人:曾逸夫
# 创建时间2022-01-19
# 创建时间2022-01-20
import sys
@ -20,15 +20,12 @@ def time_format(preTime):
if (0 < s < 1):
time_str = f'{s:.3f}'
print(time_str)
return time_str
elif (h == 0 and m == 0 and s >= 1):
time_str = f'{s}'
print(time_str)
return time_str
elif (h == 0 and m > 0):
time_str = f'{m}{s}'
print(time_str)
return time_str
elif (h > 0):
if (h >= 24):
@ -36,7 +33,6 @@ def time_format(preTime):
time_str = f'{h}{m}{s}'
else:
time_str = f'{h}{m}{s}'
print(time_str)
return time_str
else:
print(f'时间格式化失败!程序结束!')