--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: libstdc++6: 4.8.0-8 upgrade breaks system_clock
- From: Tim Besard <tim.besard@gmail.com>
- Date: Wed, 29 May 2013 09:39:32 +0200
- Message-id: <20130529073932.9159.8722.reportbug@phoenix.elis.UGent.be>
Package: libstdc++6
Version: 4.8.0-8
Severity: important
Dear Maintainer,
Attached test case gets the current system time using std::chrono and using
gettimeofday, both with millisecond precision. Using libstdc++6 version 4.8.0-7,
this code works properly, both timestamps being identical. However, since
upgrading to 4.8.0-8, the std::chrono version reports a timestamp in seconds
despite the explicit duration_case to milliseconds, when compiling with GCC 4.6
or 4.7. Using libstdc++6 4.8.0-8 with GCC 4.8 results in correct output.
Looking through the preprocessed output, it seems like there is a a mismatch
between the system_clock duration of the preprocessed output (i.e. the duration
field in the system_clock struct generated by the chrono header) and the one
libstdc++ exposes. The output compiled with GCC 4.7 contains a system_clock
struct with a duration typedef'd to std::chrono::nanoseconds, which results in
correct timestamps using libstdc++6 version 4.8.0-7 but doesn't with version
4.8.0-8 (off by a factor of 1000). GCC 4.8 uses a nanosecond duration as well,
but accesses a system_clock within a V2 namespace, which seems to expose a
nanosecond-precision.
I'm guessing the upgrade to libstdc++6 version 4.8.0-8 changed the system_clock
exposed by the library, now using microsecond precision rather than nanosecond
precision (the V2 system_clock seems to be the one offering nanosecond precision
now). This conflicts with the chrono header, which -- due to the
_GLIBCXX_USE_CLOCK_REALTIME definition -- accesses the system_clock with
nanosecond duration.
Best,
Tim
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.8-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libstdc++6 depends on:
ii gcc-4.8-base 4.8.0-8
ii libc6 2.17-3
ii libgcc1 1:4.8.0-8
ii multiarch-support 2.17-3
libstdc++6 recommends no packages.
libstdc++6 suggests no packages.
-- no debconf information
#include <chrono>
#include <cstdio>
#include <sys/time.h>
int main()
{
std::chrono::time_point<std::chrono::high_resolution_clock> tp
= std::chrono::high_resolution_clock::now();
printf("C++: %lu\n", std::chrono::duration_cast<std::chrono::milliseconds>
(tp.time_since_epoch()).count());
struct timeval tv;
gettimeofday(&tv, NULL);
printf("C: %lu\n", tv.tv_sec * 1000 + tv.tv_usec / 1000);
return 0;
}
--- End Message ---
--- Begin Message ---
- To: 710220-done@bugs.debian.org
- Subject: Re: Bug#710220: libstdc++6: 4.8.0-8 upgrade breaks system_clock
- From: Matthias Klose <doko@debian.org>
- Date: Wed, 21 Aug 2013 15:45:58 +0200
- Message-id: <5214C496.8030601@debian.org>
- In-reply-to: <CALLU6nnF1c-sDwGor3mDFnM2TvLeSOJCK-4af_xKH3vFPO8oxQ@mail.gmail.com>
- References: <20130529073932.9159.8722.reportbug@phoenix.elis.UGent.be> <51A60C27.1000700@debian.org> <51A6764F.2090203@debian.org> <CALLU6nnF1c-sDwGor3mDFnM2TvLeSOJCK-4af_xKH3vFPO8oxQ@mail.gmail.com>
this is now fixed in gcc-4.6 and gcc-4.7 versions in unstable. closing the bug.
Am 30.05.2013 08:49, schrieb Tim Besard:
> Hi Matthias,
>
>> Please could you name the software where you did see this failure?
> I only spotted this regression in my own development code, so it seems
> that the impact is limited after all.
>
> Thanks,
> Tim
>
>
--- End Message ---