This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Cygwin with clock_gettime and CLOCK_MONOTONIC - gives always 0
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Cc: fortran at gcc dot gnu dot org
- Date: Thu, 11 Apr 2013 15:48:35 +0200
- Subject: Re: Cygwin with clock_gettime and CLOCK_MONOTONIC - gives always 0
- References: <5166A0B3 dot 70801 at net-b dot de> <5166BCA1 dot 5040204 at net-b dot de>
- Reply-to: cygwin at cygwin dot com, fortran at gcc dot gnu dot org
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