X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; q=dns; s=default; b=yFWgEgDOrEtBocNpvHLSvfFngSRfIHJ3r2Td7Up5ypJ QK0II5Eermlh3XjuVfAmi3mWTazqVTosO6jQPx+2TRY6EH7ExbN6stdwerfrYeAT BH2DgXmfhTXxaUdTz3xu/2s/p1/otDba0xxsc/7jACUINoK1KkIwLp8hDx1SdMV4 = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=default; bh=CCyDLQ66OQ1vczrVThYwmNnd2gU=; b=BblAnWCXNS0MDfiZ/ NE26+97ccHOH17/+KqSpGsw2gnnffQdHsLr1ge7cw9Psc3QAib1IMPgHexcTMTkR M2bcbppeg+JsqFioE8V7Ib+5+c/rkCm8nPedf7UshU++mDX++PJsumLT50ekH6nI eukwITDvlFtdBJoYjwukd2K9w0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,TW_BG autolearn=ham version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Message-ID: <5166BCA1.5040204@net-b.de> Date: Thu, 11 Apr 2013 15:37:37 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: cygwin AT cygwin DOT com, Corinna Vinschen , Christopher Faylor Subject: Cygwin with clock_gettime and CLOCK_MONOTONIC - gives always 0 References: <5166A0B3 DOT 70801 AT net-b DOT de> In-Reply-To: <5166A0B3.70801@net-b.de> X-Forwarded-Message-Id: <5166A0B3 DOT 70801 AT net-b DOT de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Please CC your reply to fortran AT gcc DOT gnu DOT org Dear all, using clock_gettime with CLOCK_MONOTONIC fails on Cygwin; it always gives 0. That breaks code compiled with GCC's gfortran which uses system_clock in libgfortran. libgfortran uses CLOCK_MONOTONIC if defined and otherwise it falls back to CLOCK_REALTIME (which works); however, Cygwin defines both. Maybe a better check would be _POSIX_MONOTONIC_CLOCK [2], however, that is also defined with Cygwin [1]. First, is a known problem that clock_gettime gives the wrong result? Secondly, do you have an idea how to test for it? One could use an exec test in configure, but that does not nicely work with cross compilations, which are commonly done for GCC. See http://gcc.gnu.org/ml/fortran/2013-04/msg00085.html for the thread at GCC, where the issue showed up. (The issue is new since GCC 4.6 (2011-01-31) as that's the first GCC version where libgfortran uses clock_gettime (when available); before gettimeofday was used. See also GCC bugreport 56919. And CLOCK_MONOTONIC appeared in Cygwin around the same time [Aug 2010], cf. [1]) Tobias [1] Cf. Cygwin-1.7.6 announcement at http://cygwin.com/ml/cygwin-announce/2010-08/msg00019.html and the "#define _POSIX_MONOTONIC_CLOCK 200112L" patch at http://sourceware.org/ml/newlib/2010/msg00454.html Note that Linux's glibc has in /usr/include/bits/posix_opt.h a more careful value: "/* The monotonic clock might be available. */", "#define _POSIX_MONOTONIC_CLOCK 0" [2] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap02.html -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple