This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Default to --enable-libstdcxx-time=auto


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]