code: func (s *streamImpl) fixupLogEntry(prev, cur *logpb.LogEntry) error {
  	if prev == nil {
  		if cur.StreamIndex != 0 {
  			return fmt.Errorf("first log entry is not zero index (%d)", cur.StreamIndex)
  		}
  	} else {
  		if cur.StreamIndex != prev.StreamIndex+1 {
  			return fmt.Errorf("non-contiguous stream indices (%d != %d)", cur.StreamIndex, prev.StreamIndex+1)
  		}
  
  		if google.DurationFromProto(cur.TimeOffset) < google.DurationFromProto(prev.TimeOffset) {
  			to := *prev.TimeOffset
  			cur.TimeOffset = &to
  		}
  	}
  
  	return nil
  }
docs: // fixupLogEntry asserts and corrects a log entry's stream offset and ordering
  // given the previous entry in the stream.
  //
  // If prev is nil, that means that cur is expected to be the first log entry
  // in the stream.