I have a subscription system that allows users to subscribe to things or people they are interested in, and receive notifications when new posts or files or images are submitted. To determine whether something is new, I track their views by tstamp. The problem is that if the webserver and the MySQL database are out of sync, a user could miss content that is posted at around the same time they view an item. or be shown an item twice.
I can eliminate this problem by retrieving tstamp from the database, but that is a lot of connections to the database just to get a tstamp. If I could regularly sync the system clocks of the webservers to our db server (as well as possible, at least), I could at least significantly minimize the problem. Does anyone have any advice regarding the best way to do this?
I am reluctant to enter the view time into the database using NOW(). I record the views with a Gearman Process, which would mean that there is always a slight delay in entering the view. However, generally, this delay is minimal, and it might be smaller than the difference between the system clocks, assuming I can't get regular syncing going.