12 lines
263 B
Go
12 lines
263 B
Go
package cmd
|
|
|
|
import "time"
|
|
|
|
func videoPercentageWatched(pos time.Duration, dur time.Duration) float64 {
|
|
var percentage float64
|
|
if dur.Milliseconds() > 0 {
|
|
percentage = (float64(pos.Milliseconds()) / float64(dur.Milliseconds())) * 100
|
|
}
|
|
|
|
return percentage
|
|
}
|