Обсуждение: Incorrect date/time returned by CURRENT_TIMESTAMP

Поиск
Список
Период
Сортировка

Incorrect date/time returned by CURRENT_TIMESTAMP

От
"Colin Mangiagalli"
Дата:
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.

Thanks
Colin


Re: Incorrect date/time returned by CURRENT_TIMESTAMP

От
"Richard Wooding"
Дата:
I think it's important to point out the following as well:

When you issue a: 'date' from cygwin prompt the time is correct
Windows is also reporting the correct time.

----- Original Message -----
From: "Colin Mangiagalli" <colin@camara.co.za>
To: <pgsql-cygwin@postgresql.org>
Cc: <richard@camara.co.za>; <colin@camara.co.za>; "Carlos Camara"
<carlos@camara.co.za>
Sent: Wednesday, June 05, 2002 10:29 AM
Subject: Incorrect date/time returned by CURRENT_TIMESTAMP


> 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.
>
> Thanks
> Colin


Re: Incorrect date/time returned by CURRENT_TIMESTAMP

От
Joel Burton
Дата:
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