[Patch, fortran] PR 53456 Improve time resolution on targets without gettimeofday

Janne Blomqvist blomqvist.janne@gmail.com
Wed May 23 17:25:00 GMT 2012


On Wed, May 23, 2012 at 6:36 PM, Tobias Burnus <burnus@net-b.de> wrote:
> Hi Janne,
>
>
> On 05/23/2012 04:44 PM, Janne Blomqvist wrote:
>>
>> some targets such as VXWorks don't provide gettimeofday but do provide
>> clock_gettime. The attached patch allows such targets to get better
>> resolution for the DATE_AND_TIME (up to the 1 millisecond limit of the
>> API) intrinsic than the 1 second resolution provided by the current
>> fallback of using the C standard time().
>>
>> Ok for trunk? (Patch both inline below and as an attachment)
>
>
> I concur and wrote essentially the same patch - except that I used a
> different condition (and forgot to change the comment):
>
> +#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_REALTIME) &&
> !defined(HAVE_CLOCK_GETTIME_LIBRT)
>
> I think in practice it shouldn't matter as librt* mostly affects GLIBC which
> has gettimeofday. Plus I believe CLOCK_REALTIME should be always available
> and only CLOCK_MONOTONIC is unimplemented on some systems (e.g. on VxWorks
> 5.5 but not on 6.x according to the documentation).
>
> (* = In intrinsics/system_clock.c, weak refs are used for librt; for
> gf_gettime that's an overkill and a simple time() as fall back is
> sufficient.)
>
> Okay with considering my preprocessor condition.

AFAICS it's not necessary. HAVE_CLOCK_GETTIME and
HAVE_CLOCK_GETTIME_LIBRT are mutually exclusive, see the test for the
latter in configure.ac. Also, POSIX states that CLOCK_REALTIME is
mandatory, and in intrinsics/system_clock.c we assume its presense if
clock_gettime is available.

Thanks for the review.

-- 
Janne Blomqvist



More information about the Gcc-patches mailing list