chore: tune clock and mutex
This commit is contained in:
parent
58e2421a5b
commit
3c78c6ac38
2 changed files with 3 additions and 3 deletions
|
|
@ -210,7 +210,7 @@ func (lp *Loadpoint) SetPlanEnergy(finishAt time.Time, energy float64) error {
|
|||
lp.Lock()
|
||||
defer lp.Unlock()
|
||||
|
||||
if !finishAt.IsZero() && finishAt.Before(time.Now()) {
|
||||
if !finishAt.IsZero() && finishAt.Before(lp.clock.Now()) {
|
||||
return errors.New("timestamp is in the past")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ func (lp *Loadpoint) resetMeasuredPhases() {
|
|||
|
||||
// getMeasuredPhases provides synchronized access to measuredPhases
|
||||
func (lp *Loadpoint) getMeasuredPhases() int {
|
||||
lp.Lock()
|
||||
defer lp.Unlock()
|
||||
lp.RLock()
|
||||
defer lp.RUnlock()
|
||||
return lp.measuredPhases
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue