Re: uptime() for postmaster

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: uptime() for postmaster
Date: 2005-01-04 06:46:53
Message-ID: 87llb97kte.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Gaetano Mendola <mendola(at)bigfoot(dot)com> writes:

> Well, the unix guys have the abit to have the uptime as an interval, I'm
> inclined to have boths: pg_uptime ( interval ) and pg_starttime ( timestamptz )

Well for the OS these are not redundant values. The clock could have been
adjusted at any time. So you can't just calculate uptime by subtracting the
current time from the start time.

I suppose this argument is true for Postgres as well. But I'm not sure
Postgres can really make the distinction as easily as the kernel. To return
the actual uptime without being deceived by clock changes it would need to
store not the wall clock time on startup, but the system uptime. And then
calculate the difference in the current system uptime. I'm not sure if there
is a portable interface to get a system uptime.

--
greg

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Karel Zak 2005-01-04 08:08:40 Re: Implementing RESET CONNECTION ...
Previous Message Bruce Momjian 2005-01-04 05:13:52 Re: [HACKERS] Bgwriter behavior