Message75859
>>> (t - epoch) // timedelta(seconds=1)
I don't like this syntax, because I can't guess the result unit:
datetime - datetime -> timedelta
but:
timedelta / timedelta -> seconds? days? nanoseconds?
If you example, you used timedelta(seconds=1), but what is the result
unit if you use timedelta(hours=1)? or timedelta(days=1,
microseconds=1)?
The problem is that timedelta has no unit (or has multiple units),
whereas timedelta.toseconds() are seconds. So about your example:
>>> (t - epoch).toseconds()
--> fractional seconds
>>> int((t - epoch).toseconds())
--> whole seconds |
|
| Date |
User |
Action |
Args |
| 2008-11-14 11:46:27 | haypo | set | recipients:
+ haypo, lemburg, tim_one, skip.montanaro, brett.cannon, jribbens, guettli, belopolsky, catlee, tomster, erik.stephens, steve.roberts |
| 2008-11-14 11:46:27 | haypo | set | messageid: <1226663187.48.0.176355231671.issue1673409@psf.upfronthosting.co.za> |
| 2008-11-14 11:46:26 | haypo | link | issue1673409 messages |
| 2008-11-14 11:46:26 | haypo | create | |
|