Re: Incorrect date/time returned by CURRENT_TIMESTAMP

From: Joel Burton <joel(at)joelburton(dot)com>
To: Colin Mangiagalli <colin(at)camara(dot)co(dot)za>
Cc: <pgsql-cygwin(at)postgresql(dot)org>, <richard(at)camara(dot)co(dot)za>, Carlos Camara <carlos(at)camara(dot)co(dot)za>
Subject: Re: Incorrect date/time returned by CURRENT_TIMESTAMP
Date: 2002-06-07 04:03:31
Message-ID: Pine.LNX.4.30.0206070002010.20353-100000@temp.joelburton.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

On Wed, 5 Jun 2002, Colin Mangiagalli wrote:

> Hi,
>
> My implementation of Postgresql is as followes:
>
> Postgresql Version: PostgreSQL 7.2.1 on i686-pc-cygwin, compiled by GCC
> 2.95.3-5
> Cygwin dll: 1.3.10
> Operating system: Windows 2000 Service Pack 2
> Processor: Intel Pentium III 1 Ghz
> Bios: Award Moduler Bios v6.00pg
>
> When I start postmaster and run 'select CURRENT_TIMESTAMP;', the date
> and time
> are correct. After a hour, I run 'select CURRENT_TIMESTAMP;' and see
> that the
> time is not the same as the system clock, in fact it is quite far
> behind.
>
> Can someone please tell me what could possibly be causing this.

CURRENT_TIMESTAMP returnst the timestamp at the start of the current
transaction. Almost certainly, you're starting a transaction, checking the
time, waiting a while, then checking the time again. Outside of a
transaction (or after the close of a transaction), CURRENT_TIMESTAMP will
be updated.

If you absolutely want the real time, regardless of transactinons, you
timeofday().

- J.

--

Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Independent Knowledge Management Consultant

In response to

Browse pgsql-cygwin by date

  From Date Subject
Next Message Alan Caudill 2002-06-07 04:34:33 Re: PostgreSQL and Cygwin stability as a production db
Previous Message Jason Tishler 2002-06-07 01:09:16 Re: Stuck in the installation