diff -r 116c86db7e17 -r fd84e0fb26d8 src/js/utils.js --- a/src/js/utils.js Wed Nov 16 10:54:13 2011 +0100 +++ b/src/js/utils.js Wed Nov 16 11:20:52 2011 +0100 @@ -29,6 +29,16 @@ return Math.floor((time/timetotal) * 100); }; +/* convert a number of seconds to a tuple of the form + [hours, minutes, seconds] +*/ +IriSP.secondsToTime = function(secs) { + var hours = Math.abs(parseInt( secs / 3600 ) % 24); + var minutes = Math.abs(parseInt( secs / 60 ) % 60); + var seconds = Math.abs(secs % 60); + + return [hours, minutes, seconds]; +} /* for ie compatibility if (Object.prototype.__defineGetter__&&!Object.defineProperty) { Object.defineProperty=function(obj,prop,desc) {