python-trio / python-trio/trio

wall clock timing functionality

Open
#173 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.3k
Forks
431
Avg merge
2d 17h
Merged PRs (30d)
6

Description

This is probably fairly low priority, but: an interesting and sometimes-useful feature is the ability to sleep until a particular wall clock time (e.g., "this cert is expiring at 2017-12-31T12:00:00Z, so I want to wake up 3 days before that so I can renew it"). This is quite different from trio's current timekeeping abilities, which are all oriented around monotonic time (which ignores clock changes, and stops while the computer is suspended, etc.). Really these are just different incommensurable time scales.

Fortunately, I don't think we need the ability to directly set a cancel scope deadline to a particular wall clock time, so this doesn't need to be integrated deep into the guts of trio's run loop. I think it'd be sufficient to provide a sleep_until_wall_clock_time (and maybe current_wall_clock_time for completeness).

This comment and the replies have some more details on this idea, including notes on how it could be implemented on different systems.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read Trio's existing monotonic timekeeping APIs first, then follow the linked comment and replies on issue #168 for platform-specific implementation details. Done means providing the proposed wall-clock sleep capability, optionally with a current-wall-clock-time helper, without integrating wall-clock deadlines into the run loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.