code: func NumberToDuration(number int64, fsp int) (Duration, error) {
  	if number > TimeMaxValue {
  		// Try to parse DATETIME.
  		if number >= 10000000000 { // '2001-00-00 00-00-00'
  			if t, err := ParseDatetimeFromNum(nil, number); err == nil {
  				dur, err1 := t.ConvertToDuration()
  				return dur, errors.Trace(err1)
  			}
  		}
  		dur, err1 := MaxMySQLTime(fsp).ConvertToDuration()
  		terror.Log(err1)
  		return dur, ErrOverflow.GenWithStackByArgs("Duration", strconv.Itoa(int(number)))
  	} else if number < -TimeMaxValue {
  		dur, err1 := MaxMySQLTime(fsp).ConvertToDuration()
  		terror.Log(err1)
  		dur.Duration = -dur.Duration
  		return dur, ErrOverflow.GenWithStackByArgs("Duration", strconv.Itoa(int(number)))
  	}
  	var neg bool
  	if neg = number < 0; neg {
  		number = -number
  	}
  
  	if number/10000 > TimeMaxHour || number%100 >= 60 || (number/100)%100 >= 60 {
  		return ZeroDuration, errors.Trace(ErrInvalidTimeFormat.GenWithStackByArgs(number))
  	}
  	t := Time{Time: FromDate(0, 0, 0, int(number/10000), int((number/100)%100), int(number%100), 0), Type: mysql.TypeDuration, Fsp: fsp}
  	dur, err := t.ConvertToDuration()
  	if err != nil {
  		return ZeroDuration, errors.Trace(err)
  	}
  	if neg {
  		dur.Duration = -dur.Duration
  	}
  	return dur, nil
  }
docs: // NumberToDuration converts number to Duration.