Skip to content

Commit 637af95

Browse files
authored
Fix datetime handling in remotezip.py (#34)
Refactor date formatting in zip file processing.
1 parent f4e6fdc commit 637af95

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎remotezip.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
22
import io
33
import zipfile
4-
from datetime import datetime
54
from itertools import tee
65

76
import requests
@@ -264,8 +263,8 @@ def _list_files(url, support_suffix_range, filenames):
264263
data = []
265264
for fname in filenames:
266265
zinfo = zip.getinfo(fname)
267-
dt = datetime(*zinfo.date_time)
268-
data.append((zinfo.file_size, dt.strftime('%Y-%m-%d %H:%M:%S'), zinfo.filename))
266+
Y, m, d, H, M, S = zinfo.date_time
267+
data.append((zinfo.file_size, f"{Y:04d}-{m:02d}-{d:02d} {H:02d}:{M:02d}:{S:02d}", zinfo.filename))
269268
_printTable(data, ('Length', 'DateTime', 'Name'), '><<')
270269

271270

0 commit comments

Comments
 (0)