Skip to content

bip-0327: use a portable monotonic clock in the reference self-test - #2278

Open
fametrano wants to merge 1 commit into
bitcoin:masterfrom
fametrano:bip327-portable-monotonic-clock
Open

bip-0327: use a portable monotonic clock in the reference self-test#2278
fametrano wants to merge 1 commit into
bitcoin:masterfrom
fametrano:bip327-portable-monotonic-clock

Conversation

@fametrano

Copy link
Copy Markdown
Contributor

bip-0327/reference.py's self-test reads time.clock_gettime_ns(time.CLOCK_MONOTONIC) for extra_in. Both symbols are documented "Availability: Unix" in CPython, so python3 reference.py raises AttributeError on Windows.

time.monotonic_ns() is the portable monotonic clock CPython documents for measuring elapsed time, available on all platforms since 3.7. It returns the same nanosecond int, so .to_bytes(8, 'big') is unaffected.

Not tested on Windows; verified against CPython's platform-availability docs.

reference.py reads time.clock_gettime_ns(time.CLOCK_MONOTONIC) to vary
extra_in across signing iterations. Both symbols are documented
"Availability: Unix", so `python3 reference.py` raises AttributeError on
Windows.

time.monotonic_ns() is the portable monotonic clock CPython documents for
measuring elapsed time, available on all platforms since 3.7. Not tested
on Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant