author | rougeronj |
Thu, 22 Jan 2015 02:21:15 +0100 | |
changeset 105 | 25ac8802c189 |
parent 99 | 9d968fbcaa2a |
child 119 | e6605fecb175 |
child 121 | df6b39f962bc |
permissions | -rw-r--r-- |
99 | 1 |
/** |
2 |
* js/utils.js |
|
3 |
* |
|
4 |
* basic tools |
|
5 |
* |
|
6 |
*/ |
|
7 |
||
8 |
'use strict'; |
|
9 |
||
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
10 |
function formatTime (ts) { |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
11 |
var hours = Math.floor( (ts/1000) / 3600 ) % 24; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
12 |
var minutes = Math.floor( (ts/1000) / 60 ) % 60; |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
13 |
var seconds = Math.floor( (ts/1000) % 60); |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
14 |
return ((hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds < 10 ? '0' + seconds : seconds)); |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
15 |
} |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
16 |
|
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
17 |
|
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
18 |
module.exports = { |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
99
diff
changeset
|
19 |
formatTime: formatTime |
99 | 20 |
}; |