Re: Some efforts to get rid of "long" in our codebase

Поиск
Список
Период
Сортировка
От Andreas Karlsson
Тема Re: Some efforts to get rid of "long" in our codebase
Дата
Msg-id 02d55a64-1243-4230-95f4-3749a05c03f4@proxel.se
обсуждение исходный текст
Ответ на Some efforts to get rid of "long" in our codebase  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers
On 11/6/25 12:46 PM, David Rowley wrote:
> I've attached a couple of patches to get the ball rolling.

This inspired me to write my own patch to chip away at the use of long.

The target for the attached patch is TimestampDifference() and 
feTimestampDifference() which return the timestamp difference in seconds 
and microseconds as a long and an int and replace it with in64 and 
int32. The return values of these functions are used a lot for printing 
durations to the log and sometimes to populate a struct timeval (in that 
case returning a timeval would make some sense but time_t is sadly 32 
bits on some platforms).

The patch also cleans up code a bit in check_log_duration() which was 
unnecessarily complicated.

But writing the mail made me wonder if a cleaner solution wouldn't be to 
just make TimestampDifference() return a TimeOffset and then write 
helper functions to e.g. convert a TimeOffset to a timeval or to 
milliseconds.

Andreas

Вложения

В списке pgsql-hackers по дате отправления: