Feature #8777

Process.mach_absolute_time

Added by Aaron Patterson over 1 year ago. Updated over 1 year ago.

[ruby-core:56551]
Status:Closed
Priority:Normal
Assignee:-

Description

Hi,

This is related to #8658. mach_absolute_time will give us a monotonic clock on OS X. I'm not sure if this fits in to clock_gettime, so I've added a new function for getting the absolute time and another function for converting the absolute time to nanoseconds.

/cc @akr

mach_absolute.patch Magnifier (2.81 KB) Aaron Patterson, 08/11/2013 06:23 PM


Related issues

Related to Ruby trunk - Feature #8658: Process.clock_gettime Closed 07/19/2013

History

#1 Updated by Akira Tanaka over 1 year ago

2013/8/11 tenderlovemaking (Aaron Patterson) tenderlove@ruby-lang.org:

Feature #8777: Process.mach_absolute_time
https://bugs.ruby-lang.org/issues/8777

This is related to #8658. mach_absolute_time will give us a monotonic clock on OS X. I'm not sure if this fits in to clock_gettime, so I've added a new function for getting the absolute time and another function for converting the absolute time to nanoseconds.

I think that "I'm not sure if this fits in to clock_gettime" is
too weak reason to introduce new methods.
--
Tanaka Akira

#2 Updated by Aaron Patterson over 1 year ago

On Sun, Aug 11, 2013 at 09:46:41PM +0900, Tanaka Akira wrote:

2013/8/11 tenderlovemaking (Aaron Patterson) tenderlove@ruby-lang.org:

Feature #8777: Process.mach_absolute_time
https://bugs.ruby-lang.org/issues/8777

This is related to #8658. mach_absolute_time will give us a monotonic clock on OS X. I'm not sure if this fits in to clock_gettime, so I've added a new function for getting the absolute time and another function for converting the absolute time to nanoseconds.

I think that "I'm not sure if this fits in to clock_gettime" is
too weak reason to introduce new methods.

Sorry, I'm asking for help. I don't know how to fit it in with
clock_gettime. Can you help me?

mach_absolute_time requires a conversion to obtain nanoseconds, but it
seems the other clocks do not.

--
Aaron Patterson
http://tenderlovemaking.com/

#4 Updated by Aaron Patterson over 1 year ago

On Fri, Aug 16, 2013 at 02:43:33PM +0900, naruse (Yui NARUSE) wrote:

Issue #8777 has been updated by naruse (Yui NARUSE).

Status changed from Open to Closed

Oops, I didn't notice this ticket.

I committed mach_absolute_time at r42573 as a part of get_clocktime with Process::CLOCK_MONOTONIC

http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/services/services.html#//apple_ref/doc/uid/TP30000905-CH219-BEHJDFCA
https://developer.apple.com/library/mac/qa/qa1398/_index.html
http://www.python.org/dev/peps/pep-0418/#monotonic-clocks

Ah great! My repo is just far behind. Thank you! <3<3

--
Aaron Patterson
http://tenderlovemaking.com/

Also available in: Atom PDF