Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem.
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Max Johnson <max.johnson@novatechautomation.com>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2024-09-24T20:44:41Z
Lists: 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
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