byexamples / byexamples/byexample

Use a monotonic clock instead of `time.time()`

Open
#109 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue
Dominant language
Python
Stars
67
Forks
9
PR merge metrics
No merged PRs in 30d

Description

**Describe the feature you'd like**
`time.time()` is sensible to time shifts due to clock readjustments via NTP
or others.

This may lead to unexpected timeouts, event to absurd elapsed time
notifications (like saying that an example took hours)

The new Python 3.x's [monotonic clock](https://docs.python.org/3/library/time.html#time.monotonic) should be immune to these.

The codes that use `time.time()` to calculate delta of times are:
- https://github.com/byexamples/byexample/blob/338911310018f21fe9f1cdb90ddcde6069626fc3/byexample/modules/progress.py#L67
- https://github.com/byexamples/byexample/blob/338911310018f21fe9f1cdb90ddcde6069626fc3/byexample/common.py#L395
- https://github.com/byexamples/byexample/blob/338911310018f21fe9f1cdb90ddcde6069626fc3/byexample/expected.py#L503

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.