// updateParams updates the timekeeping parameters based on the passed
// parameters.
//
// actual is the actual estimated timekeeping parameters. The stored parameters
// may need to be adjusted slightly from these values to compensate for error.
//
// Preconditions: c.mu must be held for writing.
updateParams updates the timekeeping parameters based on the passed
parameters.

actual is the actual estimated timekeeping parameters. The stored parameters
may need to be adjusted slightly from these values to compensate for error.

c.mu must be held for writing.
// updateParams updates the timekeeping parameters based on the passed // parameters . // // actual is the actual estimated timekeeping parameters . The stored parameters // may need to be adjusted slightly from these values to compensate for error . // // Preconditions : c . mu must be held for writing .
func (c *CalibratedClock) updateParams(actual Parameters) {
	if !c.ready {
		c.params = actual
		c.ready = true
		c.Infof("ready")
		return
	}
	newParams, errorNS, err := errorAdjust(c.params, actual, actual.BaseCycles)
	if err != nil {
		c.resetLocked("Unable to update params: %v.", err)
		return
	}
	logErrorAdjustment(c.ref.clockID, errorNS, c.params, newParams)
	if errorNS.Magnitude() >= MaxClockError {
		 N.B. logErrorAdjustment will have already logged the error
		 at warning level.
		 TODO(mpratt): We could allow Realtime clock jumps here.
		c.resetLocked("Extreme clock error.")
		return
	}
	c.params = newParams
	c.errorNS = errorNS
}
func ( c * CalibratedClock ) updateParams ( actual Parameters ) { if ! c . ready { c . params = actual c . ready = true c . Infof ( " " ) return } newParams , errorNS , err := errorAdjust ( c . params , actual , actual . BaseCycles ) if err != nil { c . resetLocked ( " " , err ) return } logErrorAdjustment ( c . ref . clockID , errorNS , c . params , newParams ) if errorNS . Magnitude ( ) >= MaxClockError { c . resetLocked ( " " ) return } c . params = newParams c . errorNS = errorNS }
updateParams updates the timekeeping parameters based on the passed
parameters.
updateParams updates the timekeeping parameters based on the passed parameters .
// At initial calibration there is nothing to correct. // Otherwise, adjust the params to correct for errors. // Something is very wrong. Reset and try again from the // beginning. // We should never get such extreme error, something is very // wrong. Reset everything and start again. // // N.B. logErrorAdjustment will have already logged the error // at warning level. // // TODO(mpratt): We could allow Realtime clock jumps here.