[patch,fortran] Fix corner case where consecutive calls to date_and_time can return times out of sequence (PR30015)

Tobias Burnus burnus@net-b.de
Tue Dec 5 08:25:00 GMT 2006


Hi FX,

FX Coudert schrieb:
>> Thus, if you don't like the patch, since the effect of the corner case
>> is now in the minute/seconds rather than in the second/milliseconds
I should really have re-read the patch and the man page of gettimeofday
-- then I wouldn't have written such nonsense!
(gettimeofday returns the numbers since the epoch thus it could not work
like I said yesterday!)

>  I think we can do better with only a call to gettimeofday:
>   (void) gettimeofday (&tv, &tz);
>   lt = &tv.tv_sec; // instead of lt = time();

That is not what I wrote yesterday, but this is what the patch is
actually doing and what I wrote in my first email:

>   lt = time (NULL);
>    [...]
>       gettimeofday (&tp)
>       lt = tp.tv_sec
>       values[7] = tp.tv_usec / 1000;


That is: If gettimeofday is available and succeeds, the tp.tv_sec are
used, otherwise the "lt = time()" is used.


An embarrassed about himself

Tobias



More information about the Fortran mailing list