From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A3AC73858D1E; Thu, 14 Jul 2022 18:19:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3AC73858D1E From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/63400] [C++11]precision of std::chrono::high_resolution_clock Date: Thu, 14 Jul 2022 18:19:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.9.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2022 18:19:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D63400 --- Comment #8 from Jonathan Wakely --- (In reply to frankhb1989 from comment #4) > With mingw-w64, the following program shows that the monotonic clock is f= ar > more precise: >=20 > #include > #include >=20 > int main() > { > using namespace std; > timespec ts; >=20 > if(clock_getres(CLOCK_REALTIME, &ts) =3D=3D 0) > cout << "CLOCK_REALTIME: " << ts.tv_sec << ',' << ts.tv_nsec << endl; > if(clock_getres(CLOCK_MONOTONIC, &ts) =3D=3D 0) > cout << "CLOCK_MONOTONIC: " << ts.tv_sec << ',' << ts.tv_nsec << endl; > } >=20 > The result on my machine: >=20 > CLOCK_REALTIME: 0,15625000 > CLOCK_MONOTONIC: 0,489 Is this still an issue in 2022? Using a mingw-w64 cross-compiler and running under Wine I get: CLOCK_REALTIME: 0,100 CLOCK_MONOTONIC: 0,100 Is that just because I'm using Wine not real Windows?=