| delorie.com/archives/browse.cgi | search | 
| 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: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 AT cygwin DOT com; run by ezmlm | 
| List-Id: | <cygwin.cygwin.com> | 
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> | 
| List-Archive: | <http://sourceware.org/ml/cygwin/> | 
| List-Post: | <mailto:cygwin AT cygwin DOT com> | 
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> | 
| 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=-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 AT cygwin DOT com> | 
| To: | cygwin AT cygwin DOT com | 
| Cc: | fortran AT gcc DOT gnu DOT org | 
| Subject: | Re: Cygwin with clock_gettime and CLOCK_MONOTONIC - gives always 0 | 
| Message-ID: | <20130411134835.GD18333@calimero.vinschen.de> | 
| Reply-To: | cygwin AT cygwin DOT com, fortran AT gcc DOT gnu DOT org | 
| Mail-Followup-To: | cygwin AT cygwin DOT com, fortran AT gcc DOT gnu DOT org | 
| References: | <5166A0B3 DOT 70801 AT net-b DOT de> <5166BCA1 DOT 5040204 AT net-b DOT de> | 
| MIME-Version: | 1.0 | 
| 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 AT gcc DOT gnu DOT 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
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |