From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS6939 64.71.128.0/18 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.clogger.general Subject: [PATCH] another try to fix systems without CLOCK_MONOTONIC Date: Fri, 14 Jan 2011 17:31:37 +0000 Message-ID: <20110114173137.GB914@dcvr.yhbt.net> References: <20110113003708.GA13256@dcvr.yhbt.net> <20110113003708.GA13256@dcvr.yhbt.net> <20110114091438.GB30950@dcvr.yhbt.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1295026308 7862 80.91.229.12 (14 Jan 2011 17:31:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 14 Jan 2011 17:31:48 +0000 (UTC) To: clogger@librelist.org Original-X-From: clogger@librelist.org Fri Jan 14 18:31:43 2011 Return-path: Envelope-to: gcrcg-clogger@m.gmane.org List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Precedence: list Original-Sender: clogger@librelist.org Xref: news.gmane.org gmane.comp.lang.ruby.clogger.general:44 Archived-At: Received: from zedshaw.xen.prgmr.com ([64.71.167.205]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PdnV1-00025L-CA for gcrcg-clogger@m.gmane.org; Fri, 14 Jan 2011 18:31:43 +0100 Received: from zedshaw.xen.prgmr.com (localhost [IPv6:::1]) by zedshaw.xen.prgmr.com (Postfix) with ESMTP id 25AB521C64A for ; Fri, 14 Jan 2011 17:44:37 +0000 (UTC) Eric Wong wrote: > Eric Wong wrote: > > I've just pushed this out to git://git.bogomips.org/clogger.git > > > > If you're using a crazy, non-Free OS[1] favored by many Rubyists, > > please tell me if it works or not with this patch. > > > > [1] - I don't and will never endorse non-Free Software nor any > > for-profit organizations in my Free Software works. > > Here's another one which should work better, let us know if it > works for you or not (and which system you're running). Yup, it was late and I fucked up a typedef. This also accounts for CLOCK_MONONTIC being a function call, too. >>From b48017f818e13f8c7ddb555f8fe5fa895521af7a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 14 Jan 2011 17:26:59 +0000 Subject: [PATCH] another try to fix systems without CLOCK_MONOTONIC Fix a reversed typedef and also deal with the case where CLOCK_MONOTONIC is a function call and not a constant macro. --- ext/clogger_ext/broken_system_compat.h | 2 +- ext/clogger_ext/clogger.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/clogger_ext/broken_system_compat.h b/ext/clogger_ext/broken_system_compat.h index ec635b1..632612b 100644 --- a/ext/clogger_ext/broken_system_compat.h +++ b/ext/clogger_ext/broken_system_compat.h @@ -4,7 +4,7 @@ */ #ifndef HAVE_TYPE_CLOCKID_T -typedef clockid_t int; +typedef int clockid_t; #endif #ifndef HAVE_CLOCK_GETTIME diff --git a/ext/clogger_ext/clogger.c b/ext/clogger_ext/clogger.c index 604b9b6..d96b046 100644 --- a/ext/clogger_ext/clogger.c +++ b/ext/clogger_ext/clogger.c @@ -25,12 +25,14 @@ * since we could've been built on a different system than we're run * under. */ -static clockid_t hopefully_CLOCK_MONOTONIC = CLOCK_MONOTONIC; +static clockid_t hopefully_CLOCK_MONOTONIC; static void check_clock(void) { struct timespec now; + hopefully_CLOCK_MONOTONIC = CLOCK_MONOTONIC; + /* we can't check this reliably at compile time */ if (clock_gettime(CLOCK_MONOTONIC, &now) == 0) return; -- Eric Wong