minifluxmpv/cmd/helpers.go
2025-01-26 22:37:37 +01:00

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
}