PDA

View Full Version : Web/MySQL server time synch?


tsmori
6-13-04, 01:05 PM
Here's my problem:

Webserver(mars) time: 2004-06-13 08:59:06
MySQL server(mysql01) time: 2004-06-13 08:57:51

While this may seem somewhat insignificant for probably the vast majority of web-based applications, it's kinda screwing things up for me. In fact, if it was the other way around, i.e. MySQL time in the future, it might be okay, but the database time being over a minute in the past really hoses up my application.

Because this time differential is not always consistant, I can't take account for it programmatically.

If there is any way you all could see using the same time server or somehow synching up the server times, that'd be great. If not, I'll likely have to move my application onto a server that runs both apache and mysql, so the time will always be the same.

Pig
6-13-04, 06:56 PM
Your solution of moving them onto the same server is poor design. You should always use the one time that you know will be safe (eg: the http server, not the mysql server). There is nothing you can do in mysql that you cannot use the PHP functions for. If you need to insert a time into the database, just calculate it in PHP and then insert it as a var instead of using mysql's native time functions.

Having dedicated mysql servers is more efficient anyway, and relying on a specific server config if you don't need to is a bad idea regardless of the software in question.

The best thing to do is write your software smartly, and not rely on an inferior server configuration.