Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhEJN-0001Cw-JS for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 15:31:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jhEJM-0005Tw-GS for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 15:31:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhEJM-0005Tp-8E for pgsql-general@lists.postgresql.org; Fri, 05 Jun 2020 15:31:12 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhEJA-0005UR-RQ for pgsql-general@lists.postgresql.org; Fri, 05 Jun 2020 15:31:11 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id E610231BD; Fri, 5 Jun 2020 17:30:57 +0200 (CEST) Date: Fri, 5 Jun 2020 17:30:57 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Binary encoding of TIMESTAMP WITH TIME ZONE Message-ID: <20200605153057.GA11484@hjp.at> References: <1375425.1591317171@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline In-Reply-To: <1375425.1591317171@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-06-04 20:32:51 -0400, Tom Lane wrote: > Joe Abbate writes: > > However, when using the same query using the Rust adapter the transitio= n=20 > > to a new row started showing up after midgnight GMT. I opened an issue= =20 > > on Github (https://github.com/sfackler/rust-postgres/issues/608 ) and= =20 > > the maintainer claimed the Rust adapter *had* to initialize timezone to= =20 > > UTC in order to properly convert "to and from time datatypes". I=20 > > pointed out that the timezone offset is available in psql and psycopg2,= =20 > > but then he replied the binary encoding of timestamptz does *not*=20 > > include the timezone offset. >=20 > Indeed it does not, just as the on-disk format for it does not. The > representation is effectively always in UTC. If you have some other > timezone setting selected, timestamptz_out rotates to that zone for > display purposes ... but the binary format doesn't. However, the explanation still sounds off. I'm not familiar with Rust, but I wouild expect the Rust time type to be based on Unix time_t or some variant of it (maybe milliseconds as in Java, or nanoseconds or a different epoch). That also doesn't include a timezone, so conversion should be straightforward and not require any timezone to be involved. hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --h31gzZEtNLTqOjlF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAl7aZS0ACgkQ8g5IURL+ KF14OhAAlwIMv9RagGGkFRsG11vVM8cALAgqRCBgiOxPVi//XzDNMLz6kz6DAL2W Q2zGtXB5SlyWwBbvHdpc0xSEmHj1wGKDcXt8PF+9NXr9dElMTDttd67LVbuWYsUd f69BFWZPynGHj4mjr1wl0zD47AHhtIQtmpuc0Nu1bbP82e5VqxcsA0OQQjHO+DeM PUVHJt1fQb5L0/8eAbgC846gYRUfPwbwXYh0REvo8p/84Ppf3aI/USlg27+10vDa GU6K5B+kwLMmMxukb9prl9wYiAwmahQaqKyPUZ07lkpPiuvPWiqK8NAEhQnk2F6s PGBDGoDZGfo79t7894aDaOh/I1VxeaS9CtqyZ1ZaBDZp3fOhubM1h5yc3PAj4Yh/ 2hUkRtO9dt8EeVJ6AnNgcbWGHXo7Xo4EYDHHfoIDrbpcfBq5zMAg+/oZ4E7ZP6RQ RjCMP/FirAactZaUOvz2jJe3GP1hu1KZJ/o6T7hZaCjdUVhj0/uJrxWg2NYPeNW0 RVTEfKYFCUb7JVR7p6pXncS1Tt7qxdAHt/iwdkiVZNLRusY+xCnxh1LiNAVNFc2y ObH/B9N1NzdMkXGDyjkxbZmQQQshS8LYW2dmU6LRrpGj1o1cZNifcgHigpe6tk7s DW6nvt3/lveMl5uc+sxtWMoamNcZ02bgs1/KzB9VxK3qzdqaqHk= =+aJ/ -----END PGP SIGNATURE----- --h31gzZEtNLTqOjlF--