Arithmetic type emulator helper class for testcases.

Chris Fairles chris.fairles@gmail.com
Fri Jul 11 16:29:00 GMT 2008


On Fri, Jul 11, 2008 at 10:20 AM, Paolo Carlini
<paolo.carlini@oracle.com> wrote:
> Hi Chris,
>
>> Since I need it in several test case files, can it be placed
>> in one of the util headers? Does it seem like something useful outside
>> of duration testing?
>
> The idea certainly makes sense. Many time in the past set of testcases for new facilities included some infrastructure like that. I think you should just make sure the code follows the existing practice for the general features and just submit it with the rest. Can you remind me where are we as regards <chrono>? Do we need some configury bits to enable the code only when some system calls are available or something like that?
>
> Paolo.
>
>

Without the clocks (because I'm sure they'll require "configury bits")
it does include <ratio> so I put in the _GLIBCXX_USE_C99_STDINT_TR1
guard. With the clocks I have to include <ctime> for std::time_t and
std::time() plus convert <mutex> and <condition_variable> to use the
<chrono> clock instead of the <date_time> clock (and consequently,
remove <date_time>).  I don't think <ctime> should be an issue because
the configury bits should already be in place no?

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.

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).

Chris



More information about the Libstdc++ mailing list