From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Denis A Ustimenko <denis(at)oldham(dot)ru>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c |
Date: | 2002-10-15 16:31:41 |
Message-ID: | 3DAC42ED.3010603@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>>Good question. What is going to happen is that select() is going to be
>>passed tv_sec = 1, and it is going to sleep for one second. Now, if
>>select is interrupted, another time() call is going to be made.
>
> There is a very simple answer to this, which I think I suggested to Joe
> originally, but it's not in the code now: the initial calculation of
> finish_time = now() + timeout must add one. This ensures that any
> roundoff error is in the conservative direction of timing out later,
> rather than sooner.
Yes, my bad, I guess.
The thing was that with the extra +1, I was repeatedly getting a wall-clock
time of 2 seconds with a timeout set to 1 second. It seemed odd to have my 1
second timeout automatically turned into 2 seconds every time. With the
current code, I tried a timeout of 1 second at least a 100 times and it always
took about 1 full wall-clock second. But I guess if there is some corner case
that needs it...
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-10-15 16:34:10 | Re: Current CVS - something broken in contrib |
Previous Message | Teodor Sigaev | 2002-10-15 16:06:38 | Current CVS - something broken in contrib |