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 might be a hard sell for s
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.
--
___
Python tracker
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 issue mentions "I hav
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, 1970-01-01 00:00:00 +00
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
___
Python
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' python /tmp/test2.py
148