This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Arithmetic type emulator helper class for testcases.
Hi,
> help!? :)
I looked a bit around, in particular this piece of GPL code:
http://tinyurl.com/6ykloa
I think that, for now at least, we can proceed with a very simple TRY_COMPILE following this scheme:
#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
clock_gettime(CLOCK_MONOTONIC, &timer);
#elif _POSIX_TIMERS > 0
clock_gettime(CLOCK_REALTIME, &timer);
#else
gettimeofday(&timer, NULL);
#endif
Note that, if we really need a TRY_RUN, we have to make sure it's run only when $GLIBCXX_IS_NATIVE. But really, let's try first something simple like the above and move ahead, we can revisit the issue later only if something doesn't work on less common targets. Ah, one final detail, you don't need to check for the existence of the <time.h> header (in fact we are unconditionally including it in <ctime> and nobody complained ;)
Paolo.