Re: timestamps and dates - Mailing list pgsql-general

From Antti Haapala
Subject Re: timestamps and dates
Date
Msg-id Pine.GSO.4.44.0304291128200.26500-100000@paju.oulu.fi
Whole thread Raw
In response to Re: timestamps and dates  (Antti Haapala <antti.haapala@iki.fi>)
Responses Re: timestamps and dates  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Tue, 29 Apr 2003, Antti Haapala wrote:

> On Mon, 28 Apr 2003, Nigel J. Andrews wrote:
>
> > On Tue, 29 Apr 2003, Antti Haapala wrote:
> >
> > > And what comes to leap second accounting, the leap seconds were introduced
> > > in 1972 and after that only ~35 leap seconds have been added to UTC.
> > >
> > > You could try this on your box (it *might* work):
> > >
> > > % date +%s -d '31-dec-1998 23:59:60'
> > > 915141600
> > > % date +%s -d '1-jan-1999 00:00:00'
> > > 915141600
> > >
> > > If there's one second difference in numbers it implies that leap second
> > > accounting is on in your timezone file.
> >
> > I'm definitely going to try this out tomorrow during a break.
>
> This works better: The number of seconds from Epoch in POSIX compliant
> timezones at even hours is divisible by 3600... :)
>
> % export TZ=Europe/Helsinki
> % date +%s -d 00:00:00
> 1051563600
>
> ...while...
>
> % export TZ=right/Europe/Helsinki
> % date +%s -d 00:00:00
> 1051563622
>
> So zones in 'right' folder have leap second support on. The difference is
> correct - 22 (i had it wrong before), the number of leap seconds inserted
> since UTC Epoch on 1 Jan 1972.

Hmm...

db=# select version();
                            version
---------------------------------------------------------------
 PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.95.4
(1 row)

ilmo=# select '1998-31-12 23:59:59 UTC'::timestamp with time zone;
      timestamptz
------------------------
 1999-01-01 01:59:59+02
(1 row)

ilmo=# select '1998-31-12 23:59:60 UTC'::timestamp with time zone;
ERROR:  Bad timestamp external representation '1998-31-12 23:59:60
UTC'

My timestamp surely is legal according to ISO-8601.

--
Antti Haapala


pgsql-general by date:

Previous
From: Shridhar Daithankar
Date:
Subject: Re: Estimating space required for indexes
Next
From: Mark Kirkwood
Date:
Subject: Re: Solaris