This is the mail archive of the mailing list for the libstdc++ 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:

+      timespec tp;
+      // -EINVAL, -EFAULT
+      clock_gettime(CLOCK_REALTIME, &tp);
+      return time_point(duration(chrono::seconds(tp.tv_sec)
+ + chrono::nanoseconds(tp.tv_nsec)));
+      timeval tv;
+      // EINVAL, EFAULT
+      gettimeofday(&tv, 0);
+      return time_point(duration(chrono::seconds(tv.tv_sec)
+ + chrono::microseconds(tv.tv_usec)));
+      std::time_t __sec = std::time(0);
+      return system_clock::from_time_t(__sec);


    return system_clock::now();

I'm also wondering if

+  [ 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

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]