clogger RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] another try to fix systems without CLOCK_MONOTONIC
  @ 2011-01-14 17:31 14%   ` Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2011-01-14 17:31 UTC (permalink / raw)
  To: clogger

Eric Wong <normalperson@yhbt.net> wrote:
> Eric Wong <normalperson@yhbt.net> 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 <normalperson@yhbt.net>
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


^ permalink raw reply related	[relevance 14%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2011-01-13  0:37     [PATCH] attempt to support broken/crazy systems Eric Wong
2011-01-14  9:14     ` Eric Wong
2011-01-14 17:31 14%   ` [PATCH] another try to fix systems without CLOCK_MONOTONIC Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/clogger.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).