This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2014年09月01日 10:03 by Dima.Tisnek, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg226224 - (view) | Author: Dima Tisnek (Dima.Tisnek) * | Date: 2014年09月01日 10:03 | |
$ python2 -c 'import datetime; print datetime.time(10, 44, 11).strftime("%s")'
-2208955189
$ python3 -c 'import datetime; print (datetime.time(10, 44, 11).strftime("%s"))'
-2208955189
So apparently, datetime.time(...).strftime("%s") semantically "seconds since unix epoch" assumes Jan 1, 1900 for missing date part.
However datetime module doesn't allow subtracting time objects, i.e. no assumption of date is made, where "same date" chould be reasonable.
|
|||
| msg226231 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2014年09月01日 16:13 | |
I believe this is effectively a duplicate of issue 12750. That is, python doesn't do anything in particular with %s, it just lets the platform do what it will. Issue 12750 is about making what it does consistent and cross-platform. (On gentoo linux I get -1 from your examples for both python2 and python3.) You should any any further comments to issue 12750. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:07 | admin | set | github: 66517 |
| 2014年09月01日 16:13:24 | r.david.murray | set | status: open -> closed superseder: add cross-platform support for %s strftime-format code nosy: + r.david.murray messages: + msg226231 resolution: duplicate stage: resolved |
| 2014年09月01日 10:03:22 | Dima.Tisnek | create | |