client/annotviz/app/js/utils.js
changeset 105 25ac8802c189
parent 99 9d968fbcaa2a
child 119 e6605fecb175
child 121 df6b39f962bc
equal deleted inserted replaced
104:685c5ebc59d0 105:25ac8802c189
     5 *
     5 *
     6 */
     6 */
     7 
     7 
     8 'use strict';
     8 'use strict';
     9 
     9 
    10 function rgb2hex (r, g, b) {
    10 function formatTime (ts) {
    11 	return "0x"
    11 	var hours = Math.floor( (ts/1000) / 3600 ) % 24;
    12 		 + ("0" + parseInt(r, 10).toString(16)).slice(-2)
    12 	var minutes = Math.floor( (ts/1000) / 60 ) % 60;
    13 		 + ("0" + parseInt(g, 10).toString(16)).slice(-2)
    13 	var seconds = Math.floor( (ts/1000) % 60);
    14 		 + ("0" + parseInt(b, 10).toString(16)).slice(-2);
    14 	return ((hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds  < 10 ? '0' + seconds : seconds));
       
    15 }
       
    16 
       
    17 
       
    18 module.exports = {
       
    19 	formatTime: formatTime
    15 };
    20 };
    16 
       
    17 module.exports = rgb2hex;