code: func (t *TimePeriod) ToSeconds() (int64, error) {
  	if t == nil {
  		return 0, nil
  	}
  	switch t := t.Time.(type) {
  	case *TimePeriod_Duration:
  		return t.ToSeconds()
  	case *TimePeriod_Seconds:
  		return t.Seconds, nil
  	default:
  		return 0, errors.Reason("unexpected type %T", t).Err()
  	}
  }
docs: // ToSeconds returns this time period in seconds. Clamps to math.MaxInt64.