src/js/utils.js
branchpopcorn-port
changeset 252 fd84e0fb26d8
parent 160 d3f336807ec3
child 253 95c6b77f005e
--- 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) {