Adam Williamson added the comment:
Yeah, I've added a comment there. I agree we can keep subsequent discussion in
that issue. Closing this as a dupe.
I actually have the same thought as you, but I suspect making something that
"worked" before start throwing an error
Paul Ganssle added the comment:
I suspect discussion should be centralized in issue 12750, but if it were up to
me %s would either work as expected or throw an error. Silently giving the
wrong answer is a terrible compromise.
--
Adam Williamson added the comment:
I'd suggest that if that is the case, it would be better for the docs to
*specifically mention* that `%s` is not supported and should not be used,
rather than simply not mentioning it.
When it's used in real code (note someone in the SO
Adam Williamson added the comment:
Paul: right. This is on Linux - specifically Fedora Linux, but I don't think it
matters. glibc strftime and strptime depend on an underlying struct called
'tm'. 'man strftime' says:
%s The number of seconds since the Epoch,
Paul Ganssle added the comment:
It seems that %s is not supported and the fact that it works at all is
incidental. See issue 12750 and this SO thread:
https://stackoverflow.com/questions/11743019/convert-python-datetime-to-epoch-with-strftime
--
Paul Ganssle added the comment:
adamwill: I think datetime's strftime is a wrapper around the system strftime,
so it varies between platforms. Might be useful to specify which platform you
are seeing this behavior on.
--
nosy: +p-ganssle
New submission from Adam Williamson :
Test script:
import pytz
import datetime
utc = pytz.timezone('UTC')
print(datetime.datetime(2017, 1, 1, tzinfo=utc).strftime('%s'))
Try running it with various system timezones:
[adamw@xps13k pagure (more-timezone-fun %)]$ TZ='UTC'