This is the mail archive of the libstdc++@gcc.gnu.org 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: Arithmetic type emulator helper class for testcases.


Hi,

> I just wanted some feedback based on new information I've
> gathered regarding the clocks and POSIX systems.

Always remember, however, that we cannot assume POSIX, we can only in general assume C89, anything beyond it requires configure tests.

                                                                  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.

I think you need 2 tests (TRY_COMPILE is enough): the first one for the availability of clock_gettime in <time.h>; then another for unistd.h defining _POSIX_MONOTONIC_CLOCK (you have lots of examples in acinclude.m4 about checking for the availability of a function, checking for the preliminary availability of unistd.h, etc). The constants you mentioned above are just possible values of the first argument of clock_gettime, not something to be used at configure time. Please take time to experiment a bit, there are always various, stricter and less strict, ways to perform such tests. I suggest using as a reference the various entries (in a particular, unistd.h, and clock_gettime) of http://www.unix.org/single_unix_specification/

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]