Comments (3)
Note that the loop uses time.monotonic()
, not time.time()
, so time since the Unix epoch is irrelevant here. time.monotonic()
does not have a defined reference point (it's generally probably related to system uptime, but no guarantees). My personal system currently gives something around 192187.52431901
, which is happily affected by adding 1e-09
.
I don't think there's a real bug here; the likelihood of a time.monotonic()
timestamp getting big enough to cause this kind of problem seems remote. It might still be a good idea to migrate to time.monotonic_ns()
just to make the issue impossible, but that's going to take some serious consideration in all time-related asyncio
APIs to avoid breaking things with the change.
from cpython.
Some thoughts I had - ideally timestamps would be 64bit ints with nanosecond precision - then the above calculation would work out. However, since we are dealing with 64bit floats, there's only 53 bits of precision. Perhaps when _clock_resolution
is stored in the event loop, it should be "bumped up" to the smallest increment that would not lead to precision loss. I.e. a floating point with the same exponent as a typical epoch time, but the mantissa being 1.
from cpython.
Thank you for the quick response. This makes sense to me. Feel free to close the issue. Would a comment be useful in the code to warn of this behavior? I'm not sure if there is an environment out there where the monotonic clock acts as epoch time - but if there is, then this issue would apply.
from cpython.
Related Issues (20)
- Introduce platform.vm_info (or similar) as a replacement for recently deprecated platform.java_ver. HOT 11
- Consider supporting `RustPython` and `GraalPy` in `platform.python_implementation` HOT 5
- CPython 3.12 embedded in WeeChat causes segfault on subsequent calls to Py_EndInterpreter HOT 5
- Crash when using typing and daemon threads HOT 12
- Ensure current thread state is cleared before deleting it in _PyThreadState_DeleteCurrent
- Handle errors correctly in `os_get_terminal_size_impl` in `posixmodule.c`
- Use stop-the-world to make fork and interpreter shutdown thread-safe HOT 3
- Memory corruption error if a second subinterpreter imports a module that contains certain imports
- Improve documentation on multiprocessing synchronization-between-processes HOT 3
- Python now starts supporting JIT compile. It would be better to support AOT compile officially, too. HOT 2
- Mutable default values example - TypeError: 'int' object is not iterable HOT 2
- Handle errors correctly in `_pystatvfs_fromstructstatvfs` in `posixmodule`
- Multiple things wrong with `mkpwent` in `pwdmodule`
- `doctest` cannot be used to test markdown files. HOT 2
- venv+sudo writing pycache with 'wrong' permissions
- Reading undefined value in pickle module w/memory sanitizer enabled HOT 4
- Relax list.sort()'s notion of "descending" runs HOT 7
- Document PGP release signature usage HOT 1
- Equivalent comparison operation in membership test operations for set container type is not 100% accurate. HOT 5
- Consider adding public PyLong_Sign function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpython.