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.
On Fri, Jul 11, 2008 at 12:50 PM, Paolo Carlini
<paolo.carlini@oracle.com> wrote:
> Hi,
>
>> So I figure I'd do this in two stages, one with just duration
>> and time_point. Then the clocks and thread conversion and removal
>> of date_time.
>
> Therefore, do I understand correctly that we can as well just remove immediately date_time? I would like to do that, the change is in the WP (after a specific (!) paper, N2549) and since there are also exports involved, IMHO, the sooner we do it, the better. Asking Benjamin...
>
>> The one thing thats unclear to me is how to implement the
>> high_resolution and montonic clocks. POSIX systems at least
>> have "timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp);" for the
>> monotonic and I currently use #ifdef CLOCK_MONOTONIC to use it (from
>> time.h which is included from ctime), otherwise monotonic_clock is
>> just a typedef for system_clock.. For starters I can just typedef
>> them both to system_clock (the std says this is valid).
>
> I will double check, but I think your plan is fine. We just need a new test in acinclude.m4, very similar to the work we are doing in [GLIBCXX_CHECK_C99_TR1]. Are you set for that? Really it's just matter of cut & pasting from othe existing tests ;) Remember to call test from configure.ac (around line # 115) and make sure you have installed the proper autoconf & automake (2.59 and 1.9.6, respectively). If you need further guidance, let me know...
>
> Paolo.
>
>
I just wanted some feedback based on new information I've gathered
regarding the clocks and POSIX systems. From what I gather,
gettimeofday() *must* be available to all posix systems but only
provides mircosecond resolution whereas clock_gettime (a POSIX.1b
real-time extension) gives nanosecond resolution but is only available
if CLOCK_REALTIME is defined, and the monotonic version is available
only if CLOCK_MONOTONIC is defined.
So, for the macros, I can add two checks:
AC_DEFUN([GLIBCXX_CHECK_CLOCK_REALTIME]) ... and another,
AC_DEFUN([GLIBCXX_CHECK_CLOCK_MONOTONIC]) and then define
_GLIBCXX_USE_CLOCK_REALTIME/MONOTONIC if the test passes.
Now the tests. First, should I bother checking if time.h or ctime or
both exist? Should I use TRY_RUN with something like:
#include <ctime>
#ifdef CLOCK_REALTIME
int main() {}
#endif
??
Thanks,
Chris