Обсуждение: Time slowly goes out of sync Cygwin+windows+psotgres
Running postgres on cygwin and windows. Cygwin has the correct time. Windows has the same time as cygwin. Postgres slowly goes out of sync. Over a month it ends up 10 minutes out. using e.g. "SELECT NOW()"; restart the machine and posgres is only 30 seconds out. Is postgres calculateing the time itself or reading of the machines clock? Is there a setting to make it go off the operating system clock?
Aaron <aarmel@netagi.com> writes: > Is postgres calculateing the time itself or reading of the machines clock? Postgres just asks the OS what time it is. I think you have an off-speed system clock crystal (lots of PC-grade hardware will gain or lose 10 minutes/month :-(). I don't know what test you are using to convince yourself that the OS time is correct when Postgres' time is different --- but I'll bet lunch you made a mistake. One other thing to watch for is that "SELECT now()" returns the time as of the start of the current transaction. If you said "begin" and then waited ten minutes you could get a 10-minute discrepancy. I doubt you did that, but it's something to be aware of. regards, tom lane
On Fri, 23 Aug 2002, Aaron wrote: > Running postgres on cygwin and windows. > > Cygwin has the correct time. > Windows has the same time as cygwin. > > Postgres slowly goes out of sync. Over a month it ends up 10 minutes out. > > using e.g. "SELECT NOW()"; It might be possible that time() and gettimeofday() are returning different times, we use the latter, I'd guess that what you're using to get the date may use the former if it only gives integral seconds.
At 10:14 AM 8/29/02 -0400, Tom Lane wrote: >Postgres just asks the OS what time it is. I think you have an off-speed >system clock crystal (lots of PC-grade hardware will gain or lose 10 >minutes/month :-(). On the other hand, in a day of Network Time Protocol (NTP) there is absolutely no excuse for a machine to have a date/time off by more than a few milliseconds. UNIX users probably already have an ntpd available on their system, if not it's an easy download. On my windows boxes I use "Dimension 4" http://www.thinkman.com/~thinkman for a free sntp agent. -crl -- Chad R. Larson (CRL22) chad@eldocomp.com Eldorado Computing, Inc. 602-604-3100 5353 North 16th Street, Suite 400 Phoenix, Arizona 85016-3228