> This page is for version 0.7.0.
> For other versions, use one of these documentation indexes:
> - Main (default): https://docs.nvidia.com/nemo/gym/main/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo/gym/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo/gym/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo/gym/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo/gym/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo/gym/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo/gym/v0.3.0/llms.txt
> - 0.2.1: https://docs.nvidia.com/nemo/gym/v0.2.1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.

# nemo_gym.utils.deadlines

Deadline helpers that do not depend on which clock the event loop uses.

## Module Contents

### Functions

| Name                                                               | Description                                                                |
| ------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| [`monotonic_timeout`](#nemo_gym-utils-deadlines-monotonic_timeout) | Return an `asyncio` timeout that expires at a `time.monotonic()` deadline. |

### API

```python
nemo_gym.utils.deadlines.monotonic_timeout(
    deadline: float | None
) -> asyncio.Timeout
```

Return an `asyncio` timeout that expires at a `time.monotonic()` deadline.

`asyncio.timeout_at` compares its deadline with `loop.time()`, which is not always `time.monotonic()`:
under uvloop on macOS, `loop.time()` can run days ahead of it, so a monotonic deadline passed to `timeout_at`
expires at once. This converts the deadline to a remaining duration instead.
`None` never expires.