Skip to content

Commit e99bdf5

Browse files
authored
Update lib.js
1 parent 2ceae23 commit e99bdf5

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

lib.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ var db = (sdb) => {
5454
};
5555

5656
export default {
57+
58+
second_to_clock: function(s) {
59+
var i = parseInt(s / 60 / 60);
60+
var h = i >= 10 ? `${i}` : `0${i}`;
61+
s -= i * 60 * 60;
62+
var i = parseInt(s / 60);
63+
var m = i >= 10 ? `${i}` : `0${i}`;
64+
s -= i * 60;
65+
var ss = s >= 10 ? `${s}` : `0${s}`;
66+
return `${h}:${m}:${ss}`;
67+
},
68+
69+
clock_to_second: function(s) {
70+
var l = s.split(":")
71+
return parseInt(l[0]) * 60 * 60 + parseInt(l[1]) * 60 + parseInt(l[2])
72+
},
5773

5874
country_to_emoji: function (country_code) {
5975
if (country_code === "UK") {

0 commit comments

Comments
 (0)