kopia lustrzana https://github.com/micropython/micropython-lib
time: strftime: 2nd parameter must be a struct tm tuple.
As described in https://docs.python.org/3/library/time.html#time.strftimepull/121/merge
rodzic
e14d8532fd
commit
ac66b1ca1a
|
@ -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")
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue