Project

General

Profile

Actions

Feature #11124

closed

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

Added by normalperson (Eric Wong) almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
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) almost 9 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) almost 9 years ago

Eric Wong 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) almost 9 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 :

Eric Wong 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

Updated by normalperson (Eric Wong) almost 9 years ago

"NARUSE, Yui" 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...

Actions #5

Updated by ngoto (Naohisa Goto) almost 9 years ago

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

Updated by ngoto (Naohisa Goto) almost 9 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) almost 9 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0