Project

General

Profile

Feature #11124

[PATCH] lib/*: use monotonic clock for timeouts

Added by normalperson (Eric Wong) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:69084]

Description

The monotonic clock is preferred as it is guaranteed to be
continuous and not subject to jumps due to adjustments.

Given the identical "now" method in both files (and similar code in
lib/benchmark.rb), I wonder if we should implement something like
Process.now instead...

Anyways, I'll commit this patch as-is in a few weeks/months unless there's
objections.


Files

Updated by normalperson (Eric Wong) over 5 years ago

Just checking, which systems do we support do not have CLOCK_MONOTONIC
(emulated or otherwise).

We already emulate it with mach_absolute_time() and times(), so
I'd like to remove the defined? checks from stdlib if possible.

Thanks.

ref: https://bugs.ruby-lang.org/issues/11124

Updated by normalperson (Eric Wong) over 5 years ago

Eric Wong normalperson@yhbt.net wrote:

Just checking, which systems do we support do not have CLOCK_MONOTONIC
(emulated or otherwise).

We already emulate it with mach_absolute_time() and times(), so
I'd like to remove the defined? checks from stdlib if possible.

Thanks.

ref: https://bugs.ruby-lang.org/issues/11124

Based on naruse's comment in [ruby-core:64393], I'm inclined to go
with the following which will only use CLOCK_MONOTONIC.

http://80x24.org/spew/m/1432761094-16259-1-git-send-email-e@80x24.org.txt

Updated by naruse (Yui NARUSE) over 5 years ago

I don't know an environment which doesn't have CLOCK_MONOTONIC though it may be.

2015-05-28 6:13 GMT+09:00 Eric Wong normalperson@yhbt.net:

Eric Wong normalperson@yhbt.net wrote:

Just checking, which systems do we support do not have CLOCK_MONOTONIC
(emulated or otherwise).

We already emulate it with mach_absolute_time() and times(), so
I'd like to remove the defined? checks from stdlib if possible.

Thanks.

ref: https://bugs.ruby-lang.org/issues/11124

Based on naruse's comment in [ruby-core:64393], I'm inclined to go
with the following which will only use CLOCK_MONOTONIC.

http://80x24.org/spew/m/1432761094-16259-1-git-send-email-e@80x24.org.txt

--
NARUSE, Yui naruse@airemix.jp

Updated by normalperson (Eric Wong) over 5 years ago

"NARUSE, Yui" naruse@airemix.jp wrote:

I don't know an environment which doesn't have CLOCK_MONOTONIC though it may be.

Committed as r50664. Lets hope everything is OK...

#5

Updated by ngoto (Naohisa Goto) over 5 years ago

  • Related to Bug #11225: r50776 + r50780 + r50781 changes behavior on systems without HAVE_STRUCT_MSGHDR_MSG_CONTROL added
#6

Updated by ngoto (Naohisa Goto) over 5 years ago

  • Related to deleted (Bug #11225: r50776 + r50780 + r50781 changes behavior on systems without HAVE_STRUCT_MSGHDR_MSG_CONTROL)

Updated by akr (Akira Tanaka) over 5 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF