auto time increment like on facebook (jquery)
<p>Okay , im want to make something like facebook's auto time increment for posts and notificaitons etc.
when the post arrived for example , 5 seconds ago.</p>

<p>How do i use jQuery to make it auto increase without having to parse server for timeago.</p>

<p>It can increase till hours and days.</p>

<p>I have found a script , and tried modifying it , but its not working:
<a href="http://stackoverflow.com/questions/7280795/any-jquery-plugin-which-automatic-update-time-for-all-the-posts-of-a-page">Any jquery plugin which automatic update time for all the posts of a page</a></p>

<pre><code>$.fn.UpdateSince = function(interval) {

    var times = this.map(function(){ return { e: $(this), t: parseInt($(this).html()) }; });

    var format = function(t) {
        if (t &gt; 60) {
            return Math.floor(t / 60) + ' minutes ago'
        } else if(t &gt; 3600){
            return Math.floor(t / 3600) + ' hours ago'
        } else if(t &gt; 86400){
            return Math.floor(t / 86400) + ' days ago'
        } else {
            return t + ' seconds ago';
        }
    }

    var update = function(){
        $.each(times, function(i, o){
            o.e.html(format(Math.round((o.t + 1000))));
        });
    };

    window.setInterval(update, interval);
    update();

    return this;
}

$('.TimeSince').UpdateSince(1000);
</code></pre>
