From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19525 invoked by alias); 11 Apr 2013 18:32:24 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19360 invoked by uid 48); 11 Apr 2013 18:32:20 -0000 From: "jb at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/56919] [4.6/4.7/4.8/4.9 Regression] Wrong result for SYSTEM_CLOCK on Cygwin Date: Thu, 11 Apr 2013 18:32:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jb at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg01004.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56919 --- Comment #2 from Janne Blomqvist 2013-04-11 18:32:19 UTC --- (In reply to comment #0) > The problem is that Cygwin does not support CLOCK_MONOTONIC; using it will > return always return 0. > > Note that Cygwin not only defines CLOCK_MONOTONIC but since Cygwin-1.7.6 also > "_POSIX_MONOTONIC_CLOCK 200112L" [1]. Thus, _POSIX_MONOTONIC_CLOCK [2] can also > not be used. Aagh, one wonders what demented logic caused them to claim they support it and then not actually do so in any kind of useful manner.. *sigh* > Nick suggests to simply call gf_gettime unconditionally. [3] I wonder what, if any, specific issues there actually are.. Anyways, clock_gettime works fine on Linux, and IMHO it would be an annoying regression to replace the current high-resolution monotonic clock with a lower resolution non-monotonic clock, particularly since with recent glibc it should be available to all users and not only those who link in librt (e.g. implicitly via -fopenmp). I don't know how cygwin implements CLOCK_MONOTONIC, but anyway, AFAIK on windows a robust monotonic clock is available via the GetTickCount (and on Vista/2008 and up, GetTickCount64 as well) function. Thus I'd suggest that both MINGW and CYGWIN version should use those functions in the implementation of the SYSTEM_CLOCK intrinsic. An overview of various timing functions can be found e.g. at http://www.python.org/dev/peps/pep-0418/ > [3] http://gcc.gnu.org/ml/fortran/2013-04/msg00086.html