[Patch, fortran] PR 56919 SYSTEM_CLOCK on Windows

Janne Blomqvist blomqvist.janne@gmail.com
Mon Apr 15 12:44:00 GMT 2013


On Mon, Apr 15, 2013 at 11:37 AM, Tobias Burnus <burnus@net-b.de> wrote:
> Janne Blomqvist wrote:
>>
>> Attached is an updated patch which uses GetTickCount for system_clock_4;
>> this should be fine as system_clock_4 wraps around in ~25 days anyways. For
>> system_clock_8 it uses QueryPerformance{Counter,Frequency}.
>
>
>> The patch also adds an additional check for _POSIX_MONOTONIC_CLOCK.
>> Ok for trunk?
>
>
> Regarding the documentation, I wonder whether one should do the following
> additional changes:
> - Explicitly suggest to use a kind=8 argument für system_clock (for higher
> resolution and to avoid overflows).
> - To change the system_clock example to use an integer(8) argument.
> Possibly, via iso_fortran_env's int64 or via selected_int_kind(18)
>
>
> + #if defined(CLOCK_MONOTONIC) && defined(_POSIX_MONOTONIC_CLOCK)
>
> I'd add
>   && _POSIX_MONOTONIC_CLOCK >= 0
> as POSIX states: "If a symbolic constant is defined with the value -1, the
> option is not supported."
>
>
> +      uint32_t cnt = GetTickCount ();
>
> I wonder whether a comment stating that GetTickCount instead of
> QueryPerformanceCounter is used as the extra precision and 49.7-days
> overflow do not matter with the 32bit system_clock - and as
> QueryPerformanceCounter has issues on some (very few) systems.
>
>
> Otherwise, it looks fine to me.

I committed the attached patch with most of your suggestions as r197968.

Thanks for the review.



--
Janne Blomqvist
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sysclockwin.3.diff
Type: application/octet-stream
Size: 7449 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130415/47a79791/attachment.obj>


More information about the Fortran mailing list