Re: timestamps and dates

From: Antti Haapala <antti(dot)haapala(at)iki(dot)fi>
To: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: timestamps and dates
Date: 2003-04-29 08:49:57
Message-ID: Pine.GSO.4.44.0304291128200.26500-100000@paju.oulu.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mark Kirkwood 2003-04-29 08:59:14 Re: Solaris
Previous Message Mark Kirkwood 2003-04-29 08:47:10 Re: Solaris