time: strftime: 2nd parameter must be a struct tm tuple.

As described in https://docs.python.org/3/library/time.html#time.strftime
pull/121/merge
sschwartzcpu 2017-08-24 00:17:34 -05:00 zatwierdzone przez Paul Sokolovsky
rodzic e14d8532fd
commit ac66b1ca1a
1 zmienionych plików z 2 dodań i 5 usunięć

Wyświetl plik

@ -28,13 +28,10 @@ def _c_tm_to_tuple(tm):
def strftime(format, t=None): def strftime(format, t=None):
if t is None: if t is None:
t = time() t = localtime()
t = int(t)
a = array.array('i', [t])
tm_p = localtime_(a)
buf = bytearray(32) buf = bytearray(32)
l = strftime_(buf, 32, format, tm_p) l = strftime_(buf, 32, format, _tuple_to_c_tm(t))
return str(buf[:l], "utf-8") return str(buf[:l], "utf-8")