Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YnShg-0001Tg-Mr for pgsql-committers@arkaria.postgresql.org; Wed, 29 Apr 2015 14:11:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YnShg-00019r-7n for pgsql-committers@arkaria.postgresql.org; Wed, 29 Apr 2015 14:11:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YnShf-00019l-J6 for pgsql-committers@postgresql.org; Wed, 29 Apr 2015 14:11:07 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YnShb-0003YL-Rp for pgsql-committers@postgresql.org; Wed, 29 Apr 2015 14:11:06 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id D86E95F797; Wed, 29 Apr 2015 10:11:02 -0400 (EDT) Date: Wed, 29 Apr 2015 10:11:02 -0400 From: Stephen Frost To: Bruce Momjian Cc: pgsql-committers@postgresql.org Subject: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign Message-ID: <20150429141102.GX30322@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="8fFQOkr0mRRE6sJ/" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-46-generic (x86_64) X-Uptime: 10:04:40 up 40 days, 19:53, 22 users, load average: 0.14, 0.12, 0.08 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org --8fFQOkr0mRRE6sJ/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Bruce, * Bruce Momjian (bruce@momjian.us) wrote: > to_char(): have format 'OF' only show the leading negative sign >=20 > Previously both hours and minutes displayed as negative. >=20 > Report by David Pozsar This is causing the following error for me: /home/sfrost/git/pg/dev/postgresql/src/backend/utils/adt/formatting.c: In f= unction =E2=80=98DCH_to_char=E2=80=99: /home/sfrost/git/pg/dev/postgresql/src/backend/utils/adt/formatting.c:2510:= 6: warning: format =E2=80=98%ld=E2=80=99 expects argument of type =E2=80=98= long int=E2=80=99, but argument 3 has type =E2=80=98int=E2=80=99 [-Wformat= =3D] sprintf(s, ":%02ld", abs(tm->tm_gmtoff % SECS_PER_HOUR) / SECS_PER_MI= NUTE); ^ Since abs() is declared to return just an int. I don't see it anywhere in our tree and I'm not sure how portable it actually is, but labs() is supposedly in C89, so perhaps that should be used here instead? Thanks! Stephen --8fFQOkr0mRRE6sJ/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJVQOZ2AAoJEO1sijiDR2RVHBsQAKZhyyUoSLa71g7yJdK7GgG+ SE5pA6uuyFdfM5NiD6Z+xotiTuadnjB98HF1gaqxMpg4SvdFs9l3hAuoarib5ldw /uz6EIQGXXJdyJidQXWqsRJ2A3HO/rrxKF9iM1nic4lfeUb8zFHn3fcL7LC73WIU j33yWhB41Q4fz8zTAcNZqJqW8DAVqZXIvZqc+89pqRKYGz+yQQE/x7ETOmno16fV +jAfURHSd4i98/0EWHveWE7OFptn+6MX1p0MJgExba/AyLhdJ4B9XZN81JpNiP0X eOaHvPSh7KcmqQUPTpzk632mKUCCKPwfmlTkHQ04MyriJrERYZ1kjnpG/+51p6nX 1JaWV9VH+n5PR4CN2PRlPvRDv0EeIW8Rj0G+dpGLkmAgrNNZvCkJ9bNqT7kkkwas 5MuxufQ1kvBr5QcVAOHl0mDvz3lF0qNuqkb/lZLwt1k2I5i4cC+Fv7Uhpeyto5ec uqvzbL+J5dW0XrfmUJgEsiqVDzVwO7tw9+m5Z5C56jVAZE21f/hqKYrOCIY5w8+7 HZ/Q1iW7RR25puOOdht+277YEIie5AbMnu2JTysHVCMaEOAc8hg+6EYHB1pdx4x7 K5eMmtzlwzojgR6TqAy0RbVQA1fZYTFugnyXFV8diOWr6wuLea2Wh+Y45D/2qDWC vSubiWsIyPGzQMcLN7VM =VRh0 -----END PGP SIGNATURE----- --8fFQOkr0mRRE6sJ/--