Thread: Re: postgres time zone settings(time difference in Server and client)

Re: postgres time zone settings(time difference in Server and client)

From
"Anoop G"
Date:
<div dir="ltr"><br />Hai all,<br /><br />   I have  database running on server. I am using python to run my
application.postgresclient is running on the clients .All clients are connected to a single database running on server.
Eachtime application starts ,the login time is taken from server  using the query<br /> """select CAST ( timeofday() AS
timestamp"""<br/><br />But the problem the time which I got is different from that of server machine . I Think the
postgresclient is adding some values to the server time. How can I solve this .Is there any configuration setting for
clientto solve this?.In which location client's configuration file is stored( I am using Linux(Debian )?.<br /><br
/>herethe result I got:<br /><br />The correct time in server:   2008-07-25 14:16:54<br /><br />But What i got from
client(with database cursor of sever database):  <br />   2008-07-25 19:46:33.46  (difference of more than 5 Hr ) Where
thisdifference come?<br /><br />any one know the answer pls help me.<br /><br />Thanks in advance<br /><br />Anoop<br
/><br/><br /><br /></div> 

Re: postgres time zone settings(time difference in Server and client)

From
Richard Huxton
Date:
Anoop G wrote:
> Hai all,
> 
>    I have  database running on server. I am using python to run my
> application.postgres client is running on the clients .All clients are
> connected to a single database running on server. Each time application
> starts ,the login time is taken from server  using the query
> """select CAST ( timeofday() AS timestamp"""
> 
> But the problem the time which I got is different from that of server
> machine . I Think the postgres client is adding some values to the server
> time. How can I solve this .Is there any configuration setting for client to
> solve this?.In which location client's configuration file is stored( I am
> using Linux(Debian )?.

1. If you have a recent version of PostgreSQL use clock_timestamp()
2. Why are you using timestamp without timezone?

SELECT clock_timestamp();        clock_timestamp
-------------------------------- 25/07/2008 10:21:58.464055 BST

SET timezone='EST';

SELECT clock_timestamp();        clock_timestamp
-------------------------------- 25/07/2008 04:22:19.584367 EST

--   Richard Huxton  Archonet Ltd


Re: postgres time zone settings(time difference in Server and client)

From
"Pawel Socha"
Date:
<div dir="ltr">2008/7/25 Anoop G <<a href="mailto:anoopmadavoor@gmail.com">anoopmadavoor@gmail.com</a>>:<br
/><divclass="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt
0pt0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><br />Hai all,<br /><br />   I have  database running on server. I am
usingpython to run my application.postgres client is running on the clients .All clients are connected to a single
databaserunning on server. Each time application starts ,the login time is taken from server  using the query<br />
"""selectCAST ( timeofday() AS timestamp"""<br /><br />But the problem the time which I got is different from that of
servermachine . I Think the postgres client is adding some values to the server time. How can I solve this .Is there
anyconfiguration setting for client to solve this?.In which location client's configuration file is stored( I am using
Linux(Debian)?.<br /><br />here the result I got:<br /><br />The correct time in server:   2008-07-25 14:16:54<br /><br
/>ButWhat i got from client (with database cursor of sever database):  <br />   2008-07-25 19:46:33.46  (difference of
morethan 5 Hr ) Where this difference come?<br /><br />any one know the answer pls help me.<br /><br />Thanks in
advance<br/><br />Anoop<br /><br /><br /><br /></div></blockquote></div><br />server localtime is correct ?<br
/>/etc/localtime...<br /><br />-- <br />--<br />Serdecznie pozdrawiam<br /><br />Pawel Socha<br /><a
href="mailto:pawel.socha@gmail.com">pawel.socha@gmail.com</a><br/><br />programista/administrator<br /><br />perl -le
's**02).4^&-%2,).^9%4^!./4(%2^3,!#+7!2%^53%2&**y%&-;^[%"`-{ a%%s%%$_%ee' </div> 

Re: postgres time zone settings(time difference in Server and client)

From
"Anoop G"
Date:
<div dir="ltr">Hai all,<br /><br />my postgres version is PostgreSQL 8.1.8  didn't support  clock_timestamp()<br /><br
/>regards:<br/><br />Anoop<br /><br /><br /></div>