Re: Improve the granularity of PQsocketPoll's timeout parameter?
Dominique Devienne <ddevienne@gmail.com>
From: Dominique Devienne <ddevienne@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org, Tristan Partin <tristan@partin.io>, Robert Haas <robertmhaas@gmail.com>
Date: 2024-06-11T06:55:00Z
Lists: pgsql-hackers
On Mon, Jun 10, 2024 at 11:39 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > The next question is how to spell "int64" in libpq-fe.h. Hi. Out-of-curiosity, I grep'd for it in my 16.1 libpq: [ddevienne@marsu include]$ grep 'long long' *.h ecpg_config.h:/* Define to 1 if the system has the type `long long int'. */ ecpg_config.h:/* Define to 1 if `long long int' works and is 64 bits. */ pg_config.h:/* The normal alignment of `long long int', in bytes. */ pg_config.h:/* Define to 1 if `long long int' works and is 64 bits. */ pgtypes_interval.h:typedef long long int int64; And the relevant snippet of pgtypes_interval.h is: #ifdef HAVE_LONG_INT_64 #ifndef HAVE_INT64 typedef long int int64; #endif #elif defined(HAVE_LONG_LONG_INT_64) #ifndef HAVE_INT64 typedef long long int int64; #endif #else /* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */ #error must have a working 64-bit integer datatype #endif Given this precedent, can't the same be done? And if a 64-bit integer is too troublesome, why not just two 32-bit parameters instead? Either a (time_t + int usec), microsecond offset, clamped to [0, 1M), or (int sec + int usec)? I'm fine with any portable solution that allows sub-second timeouts, TBH. Just thinking aloud here. Thanks, --DD
Commits
-
Improve the granularity of PQsocketPoll's timeout parameter.
- 105024a47238 17.0 landed