Moved everything out of internal

This commit is contained in:
Stash Dev
2019-02-09 18:53:08 -08:00
parent 5b5a72364f
commit 59782a377f
92 changed files with 87 additions and 85 deletions

37
utils/vtt.go Normal file
View File

@@ -0,0 +1,37 @@
package utils
import (
"strconv"
"time"
)
func GetVTTTime(totalSeconds float64) (s string) {
totalSecondsString := strconv.FormatFloat(totalSeconds, 'f', -1, 64)
secondsDuration, _ := time.ParseDuration(totalSecondsString + "s")
// Hours
var hours = int(secondsDuration / time.Hour)
var n = secondsDuration % time.Hour
if hours < 10 {
s += "0"
}
s += strconv.Itoa(hours) + ":"
// Minutes
var minutes = int(n / time.Minute)
n = secondsDuration % time.Minute
if minutes < 10 {
s += "0"
}
s += strconv.Itoa(minutes) + ":"
// Seconds
var seconds = int(n / time.Second)
n = secondsDuration % time.Second
if seconds < 10 {
s += "0"
}
s += strconv.Itoa(seconds)
return
}