client/annotviz/app/js/utils.js
changeset 105 25ac8802c189
parent 99 9d968fbcaa2a
child 119 e6605fecb175
child 121 df6b39f962bc
--- a/client/annotviz/app/js/utils.js	Wed Jan 21 20:43:05 2015 +0100
+++ b/client/annotviz/app/js/utils.js	Thu Jan 22 02:21:15 2015 +0100
@@ -7,11 +7,14 @@
 
 'use strict';
 
-function rgb2hex (r, g, b) {
-	return "0x"
-		 + ("0" + parseInt(r, 10).toString(16)).slice(-2)
-		 + ("0" + parseInt(g, 10).toString(16)).slice(-2)
-		 + ("0" + parseInt(b, 10).toString(16)).slice(-2);
+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));
+}
+
+
+module.exports = {
+	formatTime: formatTime
 };
-
-module.exports = rgb2hex;
\ No newline at end of file