Arithmetic type emulator helper class for testcases.
Paolo Carlini
paolo.carlini@oracle.com
Sun Jul 13 01:11:00 GMT 2008
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.
More information about the Libstdc++
mailing list