Re: localtime(0)

From: "Jonathan S(dot) Katz" <jonathan(dot)katz(at)excoventures(dot)com>
To: Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: localtime(0)
Date: 2014-12-29 16:39:54
Message-ID: D5862B29-48BD-4275-A6A3-A077B2357538@excoventures.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Suresh,

On Dec 29, 2014, at 11:31 AM, Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com> wrote:

> Hi:
>
> I'm using localtime(0) in various part of the function, and updating table with the time. I use localtime at places like the start of the function and at the end of the function. The function takes about 5 mins to run,. The issue is that the function always print the same time for both start and end. I'm trying to capture the time at various point of the function, but it always print the same time. Is localtime(0) is not correct.

You probably want the "clock_timestamp()" function. There is an explanation for all the PostgreSQL current date/timestamp functions here: http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

Best,

Jonathan

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Brice André 2015-01-06 16:31:49 Add new field with auto-icrement to existing table
Previous Message Rene Romero Benavides 2014-12-29 16:39:53 Re: localtime(0)