Synchronizing Javascript clock with server clock
问题 BACKGROUND I'm creating an AJAX chat system. It looks something like this: Mike - hi Jane - 5 minutes ago Jane - hi Mike - 4 minutes ago Mike - how's it going - 3 seconds ago Jane - I'm doing good - 1 second ago Javascript polls the server every minute and the server responds with 10 of the newest messages. Attached to each message is a Unix timestamp (PHP time()). Javascript is responsible for merging the buffered messages the user currently has with this new server response. The