Re: Incorrect date/time returned by CURRENT_TIMESTAMP - Mailing list pgsql-cygwin

From Joel Burton
Subject Re: Incorrect date/time returned by CURRENT_TIMESTAMP
Date
Msg-id Pine.LNX.4.30.0206070002010.20353-100000@temp.joelburton.com
Whole thread Raw
In response to Incorrect date/time returned by CURRENT_TIMESTAMP  ("Colin Mangiagalli" <colin@camara.co.za>)
List 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@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant


pgsql-cygwin by date:

Previous
From: Jason Tishler
Date:
Subject: Re: Stuck in the installation
Next
From: Alan Caudill
Date:
Subject: Re: PostgreSQL and Cygwin stability as a production db