From 8d52600e43a9d922d21865bc336c4bb32be59f05 Mon Sep 17 00:00:00 2001 From: andig Date: Tue, 15 Sep 2020 19:32:55 +0200 Subject: [PATCH] Fix remaining charge duration rounding issue (#351) --- core/wrapper/socestimator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/wrapper/socestimator.go b/core/wrapper/socestimator.go index fec10d07f..1261211b3 100644 --- a/core/wrapper/socestimator.go +++ b/core/wrapper/socestimator.go @@ -57,7 +57,7 @@ func (s *SocEstimator) RemainingChargeDuration(chargePower float64, targetSoC in if vr, ok := s.vehicle.(api.ChargeRemainder); ok { timeRemaining, err := vr.RemainingTime() if err == nil { - return timeRemaining * time.Duration(percentRemaining/(100-s.socCharge)) + return time.Duration(float64(timeRemaining) * percentRemaining / (100 - s.socCharge)) } s.log.WARN.Printf("updating remaining time failed: %v", err)