Loadpoint: reset fake charge time when interrupting session (#22396)

This commit is contained in:
andig 2025-07-16 08:55:35 +02:00 • committed by GitHub
parent 6a7b86707f
commit 74b1fa561c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View file

@ -48,6 +48,16 @@ func (m *ChargeTimer) StopCharge() {
m.duration += m.clck.Since(m.start)
}
var _ ChargeResetter = (*ChargeTimer)(nil)
// ChargeResetter resets the charging session
func (m *ChargeTimer) ResetCharge() {
m.Lock()
defer m.Unlock()
m.duration = 0
}
// ChargeDuration implements the api.ChargeTimer interface
func (m *ChargeTimer) ChargeDuration() (time.Duration, error) {
m.Lock()