Re: gettime() - a timeofday() alternative

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: gettime() - a timeofday() alternative
Date: 2005-08-13 02:34:08
Message-ID: 200508130234.j7D2Y8G01356@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Brendan Jurd wrote:
> Hi all,
>
> I propose to add an internal function gettime() that transparently
> returns the current system time, as a timestamptz with maximum
> precision.
>
> Calling gettime() would be a more elegant approach than calling
> timeofday() and converting it to a timestamp, and avoids some of the
> potential problems in that conversion (such as "Sat" being
> misinterpreted as an Australian timezone).
>
> I'm open to alternate suggestions for the name of the function.
>
> If there are no objections, I'll start cooking up a patch right away.

We already have a TODO for this:

* Add transaction_timestamp(), statement_timestamp(), clock_timestamp()
functionality

Current CURRENT_TIMESTAMP returns the start time of the current
transaction, and gettimeofday() returns the wallclock time. This will
make time reporting more consistent and will allow reporting of
the statement start time.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-08-13 02:36:01 Re: gettime() - a timeofday() alternative
Previous Message Bruce Momjian 2005-08-13 02:32:37 Re: Enhanced containment selectivity function

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-08-13 02:36:01 Re: gettime() - a timeofday() alternative
Previous Message Bruce Momjian 2005-08-13 02:32:37 Re: Enhanced containment selectivity function