Message304456
Ok, so it seems like we need 3 rounding modes:
* _PyTime_ROUND_FLOOR: read a clock, like datetime.datetime.now(). We need to round nanoseconds since datetime.datetime only supports 1 us resolution
* _PyTime_ROUND_HALF_EVEN: "round from a Python float" like round(float), used by datetime.datetime.fromtimestamp()
* _PyTime_ROUND_UP: round timeouts, socket.settimeout(), lock.acquire(timeout), poll(timeout), etc.
_PyTime_ROUND_UP and _PyTime_ROUND_CEILING are the same for positive numbers, but using _PyTime_ROUND_CEILING causes this bug: values in ]-0.5; 0.0[ are rounding to zero which gives the wrong behaviour. It seems like _PyTime_ROUND_CEILING is not needed in Python currently. |
|
Date |
User |
Action |
Args |
2017-10-16 07:42:38 | vstinner | set | recipients:
+ vstinner, berker.peksag, serhiy.storchaka, pablogsal |
2017-10-16 07:42:38 | vstinner | set | messageid: <1508139758.02.0.213398074469.issue31786@psf.upfronthosting.co.za> |
2017-10-16 07:42:38 | vstinner | link | issue31786 messages |
2017-10-16 07:42:37 | vstinner | create | |
|