Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem.
Date
Msg-id 3486094.1727210681@sss.pgh.pa.us
Whole thread Raw
Responses Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem.
List pgsql-hackers
Nathan Bossart <nathandbossart@gmail.com> writes:
> I think we should use INT64_FORMAT here.  That'll choose the right length
> modifier for the platform.  And I don't think we need to cast MyStartTime,
> since it's a pg_time_t (which is just an int64).

Agreed.  However, a quick grep finds half a dozen other places that
are casting MyStartTime to long.  We should fix them all.

Also note that if any of the other places are using translatable
format strings, INT64_FORMAT is problematic in that context, and
"long long" is a better answer for them.

(I've not dug in the history, but I rather imagine that this is all
a hangover from MyStartTime having once been plain "time_t".)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] Add native windows on arm64 support
Next
From: Nathan Bossart
Date:
Subject: Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem.