X-Recipient: archive-cygwin@delorie.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:date:from:to:cc:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; q=dns; s=
	default; b=Phs5uvY61s8SBOvRYNlmqwZJ/T9aWJex7MFf8kLW6f7kvpceZsK1x
	/rVIYnx2B/xdmUBfr0FIDkt2TbVwtX7OvvEiSrj+R2s5b5yjFUc+U9a8S9O8JmH4
	vj7WyFswAhAUh027BkT15t/thHOKClkysC6geO8OFmPjNvJ8BxC9xk=
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:date:from:to:cc:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; s=default;
	 bh=fYtrUjQKJfEnS7fae2jv7BbE1PY=; b=VHGDZlCsAa7cQ7MJxDli1kkYhiWj
	VD9DF96ceyHq4yqReQCHr1pKstqF0g7uYWK9U9gXhOmDzQ/29yJR9tMuSVElHx2G
	zfOGXtxCz78DJOyFrH/k6Bl7MO+L9F+G0ylYqM9KyUew58hVxOuiEjsRNLAACx6x
	d2749wuCwgx6zoc=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1
Date: Thu, 11 Apr 2013 15:48:35 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Cc: fortran@gcc.gnu.org
Subject: Re: Cygwin with clock_gettime and CLOCK_MONOTONIC - gives always 0
Message-ID: <20130411134835.GD18333@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com, fortran@gcc.gnu.org
Mail-Followup-To: cygwin@cygwin.com, fortran@gcc.gnu.org
References: <5166A0B3.70801@net-b.de> <5166BCA1.5040204@net-b.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <5166BCA1.5040204@net-b.de>
User-Agent: Mutt/1.5.21 (2010-09-15)

On Apr 11 15:37, Tobias Burnus wrote:
> Please CC your reply to fortran@gcc.gnu.org

Please don't CC me or cgf.  We're subscribed to the Cygwin list anyway.

> 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.

Works fine for me with the current Cygwin 1.7.17, and the upcoming
Cygwin 1.7.18:

  $ cat > ct.c <<EOF
  #include <stdio.h>
  #include <time.h>

  int
  main ()
  {
    struct timespec tp;

    sleep (1);
    if (!clock_gettime (CLOCK_MONOTONIC, &tp))
      printf ("tv_sec = %ld, tv_nsec = %ld\n", tp.tv_sec, tp.tv_nsec);
    sleep (1);
    if (!clock_gettime (CLOCK_MONOTONIC, &tp))
      printf ("tv_sec = %ld, tv_nsec = %ld\n", tp.tv_sec, tp.tv_nsec);
    sleep (1);
    if (!clock_gettime (CLOCK_MONOTONIC, &tp))
      printf ("tv_sec = %ld, tv_nsec = %ld\n", tp.tv_sec, tp.tv_nsec);
    sleep (1);
    if (!clock_gettime (CLOCK_MONOTONIC, &tp))
      printf ("tv_sec = %ld, tv_nsec = %ld\n", tp.tv_sec, tp.tv_nsec);
  }
  EOF
  $ gcc -o ct ct.c
  $ ./ct
  tv_sec = 0, tv_nsec = 29920
  tv_sec = 1, tv_nsec = 15866090
  tv_sec = 2, tv_nsec = 28048880
  tv_sec = 3, tv_nsec = 42100530
  $


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--
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

