`time.perf_counter_ns` always a 64-bit int?

Barry barry at barrys-emacs.org
Sat Sep 16 04:52:45 EDT 2023



> On 15 Sep 2023, at 23:00, rmlibre--- via Python-list <python-list at python.org> wrote:
> 
> I'd like to capture the output of `time.perf_counter_ns()` as an 8-byte
> timestamp.
> 
> I'm aware that the docs provide an undefined start value for that clock.
> I'm going to assume that means it can't be expected to fit within 8
> bytes. However, it would be rather convenient if it could. Does anyone
> know if any such platform agnostic assumption could be made for any
> fixed number of bytes, even if it isn't exactly 8 bytes?

If you read the source code the value is stored in a 64 bit int for unix and windows.

There is a comment that it covers the range of +-232 years.

Barry

> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list