/**
* js/utils.js
*
* basic tools
*
*/
'use strict';
function formatTime (ts) {
var hours = Math.floor( (ts/1000) / 3600 ) % 24;
var minutes = Math.floor( (ts/1000) / 60 ) % 60;
var seconds = Math.floor( (ts/1000) % 60);
return ((hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds < 10 ? '0' + seconds : seconds));
}
function colorToHex(c) {
var m = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(c);
return m ? '#' + (1 << 24 | m[1] << 16 | m[2] << 8 | m[3]).toString(16).substr(1) : c;
}
module.exports = {
formatTime: formatTime,
colorToHex: colorToHex
};