32 }; |
32 }; |
33 |
33 |
34 /* convert a number of seconds to a tuple of the form |
34 /* convert a number of seconds to a tuple of the form |
35 [hours, minutes, seconds] |
35 [hours, minutes, seconds] |
36 */ |
36 */ |
37 IriSP.secondsToTime = function(secs) { |
37 IriSP.secondsToTime = function(secs) { |
38 var hours = Math.abs(parseInt( secs / 3600 ) % 24); |
38 var hours = Math.abs(parseInt( secs / 3600 ) % 24); |
39 var minutes = Math.abs(parseInt( secs / 60 ) % 60); |
39 var minutes = Math.abs(parseInt( secs / 60 ) % 60); |
40 var seconds = Math.abs(secs % 60); |
40 var seconds = parseFloat(Math.abs(secs % 60).toFixed(0)); |
41 |
41 |
42 return [hours, minutes, seconds]; |
42 return {"hours" : hours, "minutes" : minutes, "seconds" : seconds}; |
43 } |
43 } |
44 /* for ie compatibility |
44 /* for ie compatibility |
45 if (Object.prototype.__defineGetter__&&!Object.defineProperty) { |
45 if (Object.prototype.__defineGetter__&&!Object.defineProperty) { |
46 Object.defineProperty=function(obj,prop,desc) { |
46 Object.defineProperty=function(obj,prop,desc) { |
47 if ("get" in desc) obj.__defineGetter__(prop,desc.get); |
47 if ("get" in desc) obj.__defineGetter__(prop,desc.get); |