Keeping timestamps accurate in chat system - using timeago jQuery plugin
<p>I'm creating a web-based chat/messaging system. Since the chats can be saved, each message of a chat and the time in which each message was sent are stored on the server in a mysql database. Timestamps are stored in mysql DATETIME format in UTC time and the timestamps are generated on the server.</p>

<p>As messages and their accompanying timestamps are retrieved from the server, I'm using the <a href="http://timeago.yarp.com/" rel="nofollow">jQuery timeago plugin</a> and formatting the timestamps to display in the form "1 minute ago", "3 days ago", and so on.</p>

<p>The problem with this is that the "timeago" time is calculated relative to the time of the user's machine. For example, say you receive a message that was actually sent only 2 seconds ago. If your machine's time is three minutes fast relative to the server's time, then the time for this message displays as "3 minutes ago".</p>

<p>Any ideas for strategies that will always present the accurate time to the user?</p>
