3 function millisToTime(ms) {
4 var secs = Math.floor(ms / 1000);
5 var msleft = ms % 1000;
6 var hours = Math.floor(secs / (60 * 60));
7 var divisor_for_minutes = secs % (60 * 60);
8 var minutes = Math.floor(divisor_for_minutes / 60);
9 var divisor_for_seconds = divisor_for_minutes % 60;
10 var seconds = Math.ceil(divisor_for_seconds);
11 return pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + ":" + pad(msleft, 3);
15 function microsToTime(us) {
16 var ms = Math.floor(us / 1000);
17 return millisToTime(ms);
20 function pad(number, length) {
21 var str = '' + number;
22 while (str.length < length) {