Skip to content

Commit ac66b1c

Browse files
sschwartzcpupfalcon
authored andcommitted
time: strftime: 2nd parameter must be a struct tm tuple.
As described in https://docs.python.org/3/library/time.html#time.strftime
1 parent e14d853 commit ac66b1c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

time/time.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@ def _c_tm_to_tuple(tm):
2828

2929
def strftime(format, t=None):
3030
if t is None:
31-
t = time()
31+
t = localtime()
3232

33-
t = int(t)
34-
a = array.array('i', [t])
35-
tm_p = localtime_(a)
3633
buf = bytearray(32)
37-
l = strftime_(buf, 32, format, tm_p)
34+
l = strftime_(buf, 32, format, _tuple_to_c_tm(t))
3835
return str(buf[:l], "utf-8")
3936

4037

0 commit comments

Comments
 (0)