From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, T_RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: normalperson@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A84F21F6F9; Tue, 24 Sep 2013 18:09:01 +0000 (UTC) Date: Tue, 24 Sep 2013 18:09:01 +0000 From: Eric Wong To: sleepy.penguin@librelist.org Subject: Re: [sleepy.penguin] [PATCH] Support for broken system without clock_gettime. Message-ID: <20130924180901.GA8085@dcvr.yhbt.net> References: <1380012947-91938-1-git-send-email-godfat@godfat.org> <1380012947-91938-1-git-send-email-godfat@godfat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1380012947-91938-1-git-send-email-godfat@godfat.org> User-Agent: Mutt/1.5.21 (2010-09-15) List-Id: Lin Jen-Shin wrote: > Fallback mechanism was copied from clogger: > > http://clogger.rubyforge.org/ > > This would also make sleepy_penguin compiles on Mac OS X, > which is lacking clock_gettime. All tests passed for me. Pushed with the following commit addendum: [ew: fixed indentation Note: this project does not and will never officially support non-Free OSes, but there are likely other systems without clock_gettime but has kqueue (perhaps via libkqueue).] Signed-off-by: Eric Wong > +++ b/ext/sleepy_penguin/missing_clock_gettime.h > +static int fake_clock_gettime(clockid_t clk_id, struct timespec *res) > +{ > + struct timeval tv; > + int r = gettimeofday(&tv, NULL); > + > + assert(0 == r && "gettimeofday() broke!?"); I'm not sure why you switched to spaces for indentation. I just changed it back to match the original clogger code. (my preferred C indentation style is based on Linux kernel conventions)