Skip to content

On WASI, time.process_time is not in seconds #115714

Closed
@encukou

Description

@encukou

In a fresh WASI build, time.process_time, which should be in seconds, counts 10⁶ times faster than time.time:

>>> import time
>>> time.time(); time.process_time()
1708435312.596558
4775079350.12
>>> time.time(); time.process_time()
1708435313.0949461
4780063256.54
>>> time.get_clock_info('process_time')
namespace(implementation='clock_gettime(CLOCK_PROCESS_CPUTIME_ID)', monotonic=True, adjustable=False, resolution=1e-09)

It looks like WASI might remove CLOCK_PROCESS_CPUTIME_ID. Should we wait for that? Remove it from Python sooner? Work around the issue?

(Codespaces has an “unexpected error” for me right now, so I built the container from .devcontainer/Dockerfile directly. Hope that doesn't affect the result.)

Linked PRs

Metadata

Metadata

Assignees

Labels

OS-wasitype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions