Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Date
Msg-id 200210141558.g9EFwRw15251@candle.pha.pa.us
Whole thread Raw
In response to Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >> Already done -- that's what Denis is unhappy about.
> 
> > OK, I see that, but now, we are stuffing everything into a timeval
> > struct.  Does that make sense?  Shouldn't we just use time_t?
> 
> Yeah, the code could be simplified now.  I'm also still not happy about
> the question of whether it's safe to assume tv_sec is signed.  I think
> the running state should be just finish_time, and then inside the
> loop when we are about to wait, we could do
> 
>     current_time = time(NULL);
>     if (current_time >= finish_time)
>     {
>         // failure exit
>     }
>     remains.tv_sec = finish_time - current_time;
>     remains.tv_usec = 0;
>     // pass &remains to select...

That whole remains structure should be a time_t variable, and then we
_know_ we can't assume it is signed.  The use of timeval should
happen only in pqWaitTimed because it has to use select().

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Next
From: Tom Lane
Date:
Subject: Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c