Re: Cleaning up historical portability baggage - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Cleaning up historical portability baggage
Date
Msg-id CA+hUKGKwRpvGfcfq2qNVAQS2Wg1B9eA9QRhAmVSyJt1zsCN2sQ@mail.gmail.com
Whole thread Raw
In response to Re: Cleaning up historical portability baggage  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Cleaning up historical portability baggage
List pgsql-hackers
On Sun, Aug 7, 2022 at 11:08 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Andres Freund <andres@anarazel.de> writes:
> > Thanks. Next in my quest for reducing autoconf vs meson pg_config.h
> > differences is GETTIMEOFDAY stuff.
>
> I just noticed that this could be simplified:
>
>     #ifdef _MSC_VER
>     struct timezone;
>     /* Last parameter not used */
>     extern int  gettimeofday(struct timeval *tp, struct timezone *tzp);
>     #endif
>
> because what POSIX actually says is
>
>     int gettimeofday(struct timeval *restrict tp, void *restrict tzp);
>
> and
>
>     If tzp is not a null pointer, the behavior is unspecified.
>
> Indeed, we never call it with anything but a null tzp value,
> nor does our Windows fallback implementation do anything with tzp.
>
> So ISTM we should drop the bogus "struct timezone;" and declare
> this parameter as "void *tzp".

I also wonder if half the stuff in win32gettimeofday.c can be deleted.
From some light googling, it looks like
GetSystemTimePreciseAsFileTime() can just be called directly on
Windows 8+ (and we now require 10+), and that kernel32.dll malarky was
for older systems?



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Making autovacuum logs indicate if insert-based threshold was the triggering condition
Next
From: Tom Lane
Date:
Subject: Re: Cleaning up historical portability baggage