This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [patch,fortran] Fix corner case where consecutive calls to date_and_time can return times out of sequence (PR30015)


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


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