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

From: Max Johnson <max(dot)johnson(at)novatechautomation(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "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-25 15:17:45
Message-ID: CO1PR07MB90521D419ABB8EB3E74BC1028D692@CO1PR07MB9052.namprd07.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi there,

I have amended my patch to reflect the changes that were discussed and have verified on my system that it works the same as before. I have also fixed a typo and changed the name of the patch to more accurately reflect what it does now. Please let me know if there is anything else you'd like me to do.

Thanks again,

Max Johnson

Embedded Linux Engineer I

NovaTech, LLC

13555 W. 107th Street | Lenexa, KS 66215 ​

O: 913.451.1880

M: 913.742.4580​

novatechautomation.com<http://www.novatechautomation.com/> | NovaTechLinkedIn<https://www.linkedin.com/company/565017>

NovaTech Automation is Net Zero committed. #KeepItCool<https://www.keepitcool.earth/>

Receipt of this email implies compliance with our terms and conditions<https://www.novatechautomation.com/email-terms-conditions>.

________________________________
From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Sent: Tuesday, September 24, 2024 3:58 PM
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.

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

Attachment Content-Type Size
0001-pg_ctl-miscinit-don-t-cast-MyStartTime-to-long.patch text/x-patch 1.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-09-25 16:02:47 Re: XMLSerialize: version and explicit XML declaration
Previous Message Tom Lane 2024-09-25 15:08:02 Re: [PATCH] Support Int64 GUCs