Skip to content

asyncio: compute the event loop's clock resolution once, in asyncio.constants #161032

Open

Description

@asvetlov

Each BaseEventLoop.__init__ calls time.get_clock_info('monotonic').resolution and stores the result in the private attribute self._clock_resolution, which only _run_once reads. The clock resolution belongs to the platform and process, not to a loop, and it never changes at runtime.

I propose computing it once as asyncio.constants.CLOCK_RESOLUTION, next to the other asyncio tuning values. _clock_resolution is private and undocumented, so the public API doesn't change.

Linked PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    • Status
      Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions