STINNER Victor <victor.stin...@gmail.com> added the comment: I suggest to implement ROUND_UP in pytime and use it in all functions accepting a timeout, not only poll. Search for ROUND_CEILING in the code to find them. But functions accepting time like clock_settime() must continue to use ROUND_CEILING.
Does someone want to work on such patch? The new rounding mode must be test in test_time, you should just add the new mode at the top once if I recall correctly. --- select.poll currently uses ROUND_CEILING: round towards +infinity. It looks like you would prefer ROUND_UP: round away from zero, right? In the history of CPython, the rounding mode of functions accepting time, timeout, duration, etc. changed many times, mostly because the C code changed in subtle ways to fix different bugs. I mean that the exact rounding mode wasn't really chosen on purpose. I'm now trying to get better defined rouding modes in pytime, but it seems poll uses the wrong one. https://haypo.github.io/pytime.html I think that my problem is that I wanted to reuse the same rounding modes for different use cases. It seems like clocks need ROUND_CEILING but timeouts need ROUND_UP. Well, in the case of poll, the previous code before moving to pytime was using ceil() which uses ROUND_CEILING. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31786> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com