A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-March/118029.html below:

[Python-Dev] Rename time.steady(strict=True) to time.monotonic()?

[Python-Dev] Rename time.steady(strict=True) to time.monotonic()?Steven D'Aprano steve at pearwood.info
Sat Mar 24 03:08:58 CET 2012
Victor Stinner wrote:

>> Is steady() merely a convenience function to avoid the user having
>> to write something like this?
> 
> steady() remembers if the last call to monotonic failed or not. The
> real implementation is closer to something like:
> 
> def steady():
>   if not steady.has_monotonic:
>     return time.time()
>   try:
>     return time.monotonic()
>   except (AttributeError, OSError):
>     steady.has_monotonic = False
>     return time.time()
> steady.has_monotonic = True

Does this mean that there are circumstances where monotonic will work for a 
while, but then fail?

Otherwise, we would only need to check monotonic once, when the time module is 
first loaded, rather than every time it is called. Instead of the above:

# global to the time module
try:
     monotonic()
except (NameError, OSError):
     steady = time
else:
     steady = monotonic



Are there failure modes where monotonic can recover? That is, it works for a 
while, then raises OSError, then works again on the next call.

If so, steady will stop using monotonic and never try it again. Is that 
deliberate?



-- 
Steven

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4