This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch,fortran] Fix corner case where consecutive calls to date_and_time can return times out of sequence (PR30015)
- From: Tobias Burnus <burnus at net-b dot de>
- To: FX Coudert <fxcoudert at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Tue, 05 Dec 2006 09:25:18 +0100
- Subject: Re: [patch,fortran] Fix corner case where consecutive calls to date_and_time can return times out of sequence (PR30015)
- References: <456DE55F.8000201@net-b.de> <45748891.2040300@net-b.de> <32A5A350-5511-434F-94C1-501BA5B10C8F@gmail.com>
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