STINNER Victor <vstin...@python.org> added the comment:

Well, that's more a documentation issue than a bug.

"adjustable=False" in the context of Python means that the clock cannot jump a 
day forward or one day backwards.

For example, on my Fedora 30, I cannot set CLOCK_MONOTONIC clock as root:

$ sudo python3
>>> import time
>>> time.clock_settime(time.CLOCK_MONOTONIC, 
>>> time.clock_gettime(time.CLOCK_MONOTONIC))
OSError: [Errno 22] Invalid argument

In the Linux kernel, NTP adjusts CLOCK_MONOTONIC so it really measures time in 
*seconds*, rather something faster or slower than one second :-)

Python time.monotonic() documentation clearly states that it uses the unit of 
one second:
https://docs.python.org/dev/library/time.html#time.monotonic
"Return the value (in fractional seconds) of a monotonic clock, i.e. a clock 
that cannot go backwards. (...)"

CLOCK_MONOTONIC_RAW must not be used for time.monotonic() because it doesn't 
use an unit of 1 second.

Feel free to propose a documentation enhancement :-)

https://docs.python.org/dev/library/time.html#time.get_clock_info

----------
nosy: +vstinner

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38394>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to