Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem.

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Max Johnson <max(dot)johnson(at)novatechautomation(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem.
Date: 2024-09-24 20:58:08
Message-ID: ZvMn4K2PO2_7iavy@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 24, 2024 at 04:44:41PM -0400, Tom Lane wrote:
> Nathan Bossart <nathandbossart(at)gmail(dot)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.

+1

> 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.

At a glance, I'm not seeing any translatable format strings that involve
MyStartTime. But that is good to know...

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2024-09-24 21:20:36 Re: Recovering from detoast-related catcache invalidations
Previous Message Tom Lane 2024-09-24 20:44:41 Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem.