Skip to content

Instantly share code, notes, and snippets.

@larzconwell
Created May 18, 2012 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larzconwell/2727520 to your computer and use it in GitHub Desktop.
Save larzconwell/2727520 to your computer and use it in GitHub Desktop.
disp_time = function(obj) {
if(obj.length > 0) {
var time = new Date()
, tillNextMin = (60 - time.getSeconds()) * 1000
, waitLoop
, timeLoop;
obj.html(current_time());
waitLoop = setTimeout(function() {
clearTimeout(waitLoop);
obj.html(current_time());
timeLoop = setInterval(function() {
obj.html(current_time());
}, 60000);
}, tillNextMin);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment