Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem.
Max Johnson <max.johnson@novatechautomation.com>
From: Max Johnson <max.johnson@novatechautomation.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: "tgl@sss.pgh.pa.us" <tgl@sss.pgh.pa.us>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2024-09-25T15:17:45Z
Lists: pgsql-hackers
Attachments
- 0001-pg_ctl-miscinit-don-t-cast-MyStartTime-to-long.patch (text/x-patch) patch 0001
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@gmail.com> Sent: Tuesday, September 24, 2024 3:58 PM To: Tom Lane <tgl@sss.pgh.pa.us> Cc: Max Johnson <max.johnson@novatechautomation.com>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.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@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. +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
Commits
-
Add INT64_HEX_FORMAT and UINT64_HEX_FORMAT to c.h.
- efdc7d747539 18.0 landed
-
Fix Y2038 issues with MyStartTime.
- c91d0af0a2ad 12.21 landed
- b255493aefe9 13.17 landed
- a356d23fd3ad 17.1 landed
- 8aaf88b63de3 16.5 landed
- 5d6187d2a283 18.0 landed
- 5cea7168dfe6 14.14 landed
- 01731eeeaa96 15.9 landed