469,934 Members | 1,874 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

setting local time without restarting server

Hi,

Is there a function that would allow me to set the local time while the
server is running? I can't seem to find anything on this...

Thanks,
Peter
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #1
4 4599
On Thu, May 13, 2004 at 12:56:48 -0600,
Anony Mous <A.****@shaw.ca> wrote:
Hi,

Is there a function that would allow me to set the local time while the
server is running? I can't seem to find anything on this...


You probably want to set the timezone, not the local time.
You can do that with something like:
SET TIMEZONE='EST5EDT';

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
Thanks, but I do want to set the system time.

It's actually for testing purposes. Our software looks to the db server to
obtain the local date and time, however, to test various cases we need to
fiddle with this value. I'd like to do it without having to first change
the system time, and then re-start the postmaster. Sorry, I should have
clarified this in my first e-mail.

-Peter

-----Original Message-----
From: Bruno Wolff III [mailto:br***@wolff.to]
Sent: May 13, 2004 2:07 PM
To: Anony Mous
Cc: pg***********@postgresql.org
Subject: Re: [GENERAL] setting local time without restarting server

On Thu, May 13, 2004 at 12:56:48 -0600,
Anony Mous <A.****@shaw.ca> wrote:
Hi,

Is there a function that would allow me to set the local time while the
server is running? I can't seem to find anything on this...


You probably want to set the timezone, not the local time.
You can do that with something like:
SET TIMEZONE='EST5EDT';
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3
On Thu, May 13, 2004 at 15:07:13 -0500,
Bruno Wolff III <br***@wolff.to> wrote:
On Thu, May 13, 2004 at 12:56:48 -0600,
Anony Mous <A.****@shaw.ca> wrote:
Hi,

Is there a function that would allow me to set the local time while the
server is running? I can't seem to find anything on this...


You probably want to set the timezone, not the local time.
You can do that with something like:
SET TIMEZONE='EST5EDT';


Thinking about this some more; this only changes it for the session not
the default for new sessions.

Reading the documentation suggests that you can set the timezone in the
config file and sighup the postmaster to get it to reread the config file.
It might also be possible to change the underlying system's timezone
and do a sighup to have it pick up the correct timezone.

If the underlying system has the correct timezone, but for some reason has
the wrong time, you should be able to change its time. How you do that
varies a bit from system to system. Under *nix systems you usually use
the 'date' command (if you aren't using ntp). Under Linux, at least,
you also want to run setclock to set the hardware clock to the right
time so the time is still correct after the next reboot.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #4
Anony Mous <A.****@shaw.ca> writes:
Thanks, but I do want to set the system time.
You cannot do that from within Postgres, because it requires root
privileges.
I'd like to do it without having to first change
the system time, and then re-start the postmaster.


Who said anything about restarting the postmaster? Just set the system
time (eg, with date(1)).

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Harag | last post: by
4 posts views Thread by Elie Grouchko | last post: by
1 post views Thread by thomasamillergoogle | last post: by
reply views Thread by Bill Borg | last post: by
5 posts views Thread by rgrandidier | last post: by
3 posts views Thread by Randall Parker | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.