[New-bugs-announce] [issue34642] time.ctime() uses %3d instead of %.2d to format.

William Chaseling report at bugs.python.org
Tue Sep 11 23:01:23 EDT 2018


New submission from William Chaseling <williamchaseling2000 at gmail.com>:

time.ctime() returns _asctime from a C module.
_asctime returns a PyUnicode_FromFormat() result using "%s %s%3d %.2d:%.2d:%.2d %d" as the string formatter.

This works: 'Wed Sep 12 22:30:00 2018'
Except when day <10, because it uses %3d instead of %.2d
'Wed Sep  2 22:30:00 2018'

This seems like it might be intended behavior for some reason, but I don't see the reason.

----------
components: Library (Lib)
messages: 325114
nosy: William Chaseling
priority: normal
severity: normal
status: open
title: time.ctime() uses %3d instead of %.2d to format.
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34642>
_______________________________________


More information about the New-bugs-announce mailing list