Message261078
I hope my prediction "I am afraid that the rounding issues may kill this proposal" (see msg202276) will not come true.
I think the correct way to view "timespec" is a way to suppress/enforce printing of trailing digits.
Users that choose printing less than full usec format should make sure that their datetime instances are properly rounded before printing.
Unfortunately, I does not look like the datetime module makes rounding easy. The best I can think of is something like
def round_datetime(dt, delta):
dt0 = datetime.combine(dt.date(), time(0))
return dt0 + round((dt - dt0) / delta) * delta
Maybe a datetime.round() method along these lines will be a worthwhile addition? |
|
Date |
User |
Action |
Args |
2016-03-01 21:35:47 | belopolsky | set | recipients:
+ belopolsky, lemburg, gvanrossum, tim.peters, terry.reedy, vstinner, ezio.melotti, cvrebert, SilentGhost, berker.peksag, martin.panter, matrixise, jerry.elmore, acucci |
2016-03-01 21:35:47 | belopolsky | set | messageid: <1456868147.03.0.641670124104.issue19475@psf.upfronthosting.co.za> |
2016-03-01 21:35:47 | belopolsky | link | issue19475 messages |
2016-03-01 21:35:46 | belopolsky | create | |
|