Thread: Setting date and time
Hi Everyone,
Is it possible to reset the data and time in postmaster without restarting it?
Thanks,
George
George Weaver <gweaver@shaw.ca> writes: > Hi Everyone, > > Is it possible to reset the data and time in postmaster without > restarting it? PostgreSQL uses the OS clock for date/time issues. If you can change the date on your system, PostgreSQL won't complain, AFAIK. Regards, Manuel.
Hi Manuel, Thanks for the response. From what I can determine, postmaster gets the OS date and time when its starts up, but then seems to maintain the data and time independently. If you change the OS date or time after postmaster is running, the two systems will be out of synch. I'm hoping to determine if there is a way to "reset" the postmaster date and time to match that of the OS if they are out of synch, without restarting postmaster. Regards, George ----- Original Message ----- From: "Manuel Sugawara" <masm@fciencias.unam.mx> To: "George Weaver" <gweaver@shaw.ca> Cc: <pgsql-novice@postgresql.org> Sent: Wednesday, January 28, 2004 10:50 PM Subject: Re: [NOVICE] Setting date and time George Weaver <gweaver@shaw.ca> writes: > Hi Everyone, > > Is it possible to reset the data and time in postmaster without > restarting it? PostgreSQL uses the OS clock for date/time issues. If you can change the date on your system, PostgreSQL won't complain, AFAIK. Regards, Manuel.
George Weaver <gweaver@shaw.ca> writes: > Hi Manuel, > > Thanks for the response. > > From what I can determine, postmaster gets the OS date and time when > its starts up, but then seems to maintain the data and time > independently. Uh, I don't think so. > If you change the OS date or time after postmaster is running, the > two systems will be out of synch. Have you actually tried?. A little experimentation in my machine shows that this assertion is indeed false. Try it your self. Regards, Manuel.
George Weaver <gweaver@shaw.ca> writes: > From what I can determine, postmaster gets the OS date and time when its > starts up, but then seems to maintain the data and time independently. This is certainly not so. Perhaps you should tell us exactly what you are doing to draw that conclusion ... regards, tom lane
I am running version 7.3.2 on Windows XP. If I change the system date to a different date on the PC, and query the database (Select current_date), the result I get is the date on the system relative to when postmaster started as a service, not the new date on the PC. Am I missing something really obvious?? : ( test=# select now(); now ---------------------------- 2004-01-29 11:25:06.553-06 (1 row) test=# \! $ date Thu Jan 29 11:25:09 CST 2004 $ date 01\25\2004 Sun Jan 25 20:04:00 CST 2004 $ date Sun Jan 25 20:04:01 CST 2004 $ exit test=# select now(); now ---------------------------- 2004-01-29 11:25:34.032-06 (1 row) ----- Original Message ----- From: "Tom Lane" <tgl@sss.pgh.pa.us> To: "George Weaver" <gweaver@shaw.ca> Cc: "Manuel Sugawara" <masm@fciencias.unam.mx>; <pgsql-novice@postgresql.org> Sent: Thursday, January 29, 2004 10:46 AM Subject: Re: [NOVICE] Setting date and time > George Weaver <gweaver@shaw.ca> writes: > > From what I can determine, postmaster gets the OS date and time when its > > starts up, but then seems to maintain the data and time independently. > > This is certainly not so. Perhaps you should tell us exactly what you > are doing to draw that conclusion ... > > regards, tom lane >
George Weaver <gweaver@shaw.ca> writes: > I am running version 7.3.2 on Windows XP. > If I change the system date to a different date on the PC, and query the > database (Select current_date), the result I get is the date on the system > relative to when postmaster started as a service, not the new date on the > PC. Am I missing something really obvious?? : ( Hm, you're running PG under Cygwin then? This must be a Cygwin issue. Postgres itself gets the time from the operating system at the start of each transaction, and it's going to believe whatever the Cygwin implementation of gettimeofday() tells it. regards, tom lane