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.

Author vstinner
Recipients berker.peksag, pablogsal, serhiy.storchaka, vstinner
Date 2017-10-16.07:42:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1508139758.02.0.213398074469.issue31786@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-10-16 07:42:38vstinnersetrecipients: + vstinner, berker.peksag, serhiy.storchaka, pablogsal
2017-10-16 07:42:38vstinnersetmessageid: <1508139758.02.0.213398074469.issue31786@psf.upfronthosting.co.za>
2017-10-16 07:42:38vstinnerlinkissue31786 messages
2017-10-16 07:42:37vstinnercreate