code: func (g *BlkTmplGenerator) UpdateBlockTime(msgBlock *wire.MsgBlock) error {
  	// The new timestamp is potentially adjusted to ensure it comes after
  	// the median time of the last several blocks per the chain consensus
  	// rules.
  	newTime := medianAdjustedTime(g.chain.BestSnapshot(), g.timeSource)
  	msgBlock.Header.Timestamp = newTime
  
  	// Recalculate the difficulty if running on a network that requires it.
  	if g.chainParams.ReduceMinDifficulty {
  		difficulty, err := g.chain.CalcNextRequiredDifficulty(newTime)
  		if err != nil {
  			return err
  		}
  		msgBlock.Header.Bits = difficulty
  	}
  
  	return nil
  }
docs: // UpdateBlockTime updates the timestamp in the header of the passed block to
  // the current time while taking into account the median time of the last
  // several blocks to ensure the new time is after that time per the chain
  // consensus rules.  Finally, it will update the target difficulty if needed
  // based on the new time for the test networks since their target difficulty can
  // change based upon time.