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: Brooks Moses <brooks dot moses at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 04 Dec 2006 21:55:47 -0800
- 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> <4575057C.2080704@wanadoo.fr>
Paul Thomas wrote:
Tobias,
The change by Mat Cross is therefore:
- Moving the gettimeofday() block up in the file
- Using the result of gettimeofday() for lt and value[7], instead of
using time() for lt and gettimeofday() for value[7]
date_and_time.c |
I am sorry but I have stared at the patch and the explanation and am
none the wiser :-)
There is obviously something that I am missing in the mechanics of
time() and gettimeofday(). I need an explanation as to where this time
shifting comes from, I think. Is it simply that time() and
gettimeofday() are different? If so why?
I believe that the problem comes across because time() and
gettimeofday() are separate function calls, made at slightly different
times. When the returned result is calculated by assembling pieces of
the results from those two calls, it may produce a value which is not
within the range of either if the wrong time-counter happens to roll
over in the tiny span of time between the two function calls.
At least, that's my impression from the conversation; I haven't looked
at the patch in any detail.
- Brooks