Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1stCP1-00EJlC-QB for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2024 20:44:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1stCP0-00E8GQ-Nt for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2024 20:44:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1stCP0-00E8GH-E1 for pgsql-hackers@lists.postgresql.org; Tue, 24 Sep 2024 20:44:54 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1stCOt-000rqq-U0 for pgsql-hackers@postgresql.org; Tue, 24 Sep 2024 20:44:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 48OKif1x3486095; Tue, 24 Sep 2024 16:44:41 -0400 From: Tom Lane To: Nathan Bossart cc: Max Johnson , "pgsql-hackers@postgresql.org" Subject: Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem. In-reply-to: References: Comments: In-reply-to Nathan Bossart message dated "Tue, 24 Sep 2024 15:26:47 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3486093.1727210681.1@sss.pgh.pa.us> Date: Tue, 24 Sep 2024 16:44:41 -0400 Message-ID: <3486094.1727210681@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nathan Bossart 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