This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Default to --enable-libstdcxx-time=auto
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Rainer Orth <ro at cebitec dot uni-bielefeld dot de>, Benjamin Kosnik <bkoz at redhat dot com>, Paolo Carlini <paolo dot carlini at oracle dot com>, "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 24 May 2013 14:56:24 +0100
- Subject: Re: [patch] Default to --enable-libstdcxx-time=auto
- References: <yddbo81whlf dot fsf at CeBiTec dot Uni-Bielefeld dot DE> <20130523205022 dot GF1377 at tucnak dot redhat dot com> <ydd7gipwh3a dot fsf at CeBiTec dot Uni-Bielefeld dot DE> <20130523210611 dot GH1377 at tucnak dot redhat dot com> <ydd38tdwgis dot fsf at CeBiTec dot Uni-Bielefeld dot DE> <yddy5b5uzuq dot fsf at CeBiTec dot Uni-Bielefeld dot DE> <20130524075705 dot GK1377 at tucnak dot redhat dot com> <yddk3mopxat dot fsf at lokon dot CeBiTec dot Uni-Bielefeld dot DE> <20130524132117 dot GT1377 at tucnak dot redhat dot com> <ydd38tcpkks dot fsf at lokon dot CeBiTec dot Uni-Bielefeld dot DE> <20130524134056 dot GU1377 at tucnak dot redhat dot com>
On 24 May 2013 14:40, Jakub Jelinek wrote:
>
> Note that for 4.8.1 this is kind of urgent, because it is blocking 4.8.1-rc2
> and thus also 4.8.1 release, so the sooner this gets resolved, the better.
Sorry about that, I didn't realise the trunk change would affect 4.8.1
> Jonathan/Benjamin, could you please review the patch in the mean time,
> so that if it works well for Rainer, it can be applied immediately and
> 4.8.1-rc2 rolled, even during the weekend?
In the fallback for steady_clock::now() would it be easier to just
call system_clock::now() instead of duplicating its logic?
i.e .replace:
+#elif defined(_GLIBCXX_USE_CLOCK_REALTIME)
+ timespec tp;
+ // -EINVAL, -EFAULT
+ clock_gettime(CLOCK_REALTIME, &tp);
+ return time_point(duration(chrono::seconds(tp.tv_sec)
+ + chrono::nanoseconds(tp.tv_nsec)));
+#elif defined(_GLIBCXX_USE_GETTIMEOFDAY)
+ timeval tv;
+ // EINVAL, EFAULT
+ gettimeofday(&tv, 0);
+ return time_point(duration(chrono::seconds(tv.tv_sec)
+ + chrono::microseconds(tv.tv_usec)));
+#else
+ std::time_t __sec = std::time(0);
+ return system_clock::from_time_t(__sec);
#endif
with
#else
return system_clock::now();
#endif
I'm also wondering if
+ AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC_SYSCALL, 1,
+ [ Defined if clock_gettime syscall has monotonic clock support. ])
should be renamed to _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL because it is
defined when the syscall has CLOCK_REALTIME and clock_MONOTONIC
support.
Otherwise the patch is OK.