Re: Display of timestamp in pg_dump custom format

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Display of timestamp in pg_dump custom format
Date: 2014-09-04 17:19:31
Message-ID: 20140904171931.GN13008@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 3, 2014 at 08:33:31PM -0400, Bruce Momjian wrote:
> I can't seem to find a way to get the timezone offset via C; see:
>
> http://stackoverflow.com/questions/635780/why-does-glibc-timezone-global-not-agree-with-system-time-on-dst
>
> On Linux, do 'man timezone' for details. 'timezone' has the non-DST
> offset from GMT, and 'daylight' is a boolean which indicates DST, but
> not how much time is different for DST, and I am not sure it is always
> an hour. In fact 'daylight' is documented as saying whether there is
> every a daylight savings time, not that DST is active.

Uh, not sure what I was thinking --- strftime() is the way to go. Here
is the new output:

;
; Archive created at 2014-09-04 13:00:15 -0400 <---
; dbname: test
; TOC Entries: 8
; Compression: -1
; Dump Version: 1.12-0
; Format: CUSTOM
; Integer: 4 bytes
; Offset: 8 bytes
; Dumped from database version: 9.5devel
; Dumped by pg_dump version: 9.5devel

I found two other places in our dump code that use strftime with a
similar format, but they had problems with the timezone string on
Windows, so I switched those over to use a numeric timezone offset as
well.

Patch attached.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachment Content-Type Size
dumpstamp.diff text/x-diff 3.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Yetter 2014-09-04 17:37:27 Re: Pg_upgrade and toast tables bug discovered
Previous Message David G Johnston 2014-09-04 17:18:15 Re: PQputCopyEnd doesn't adhere to its API contract