func ParseFrac(s string, fsp int) (v int, overflow bool, err error) {
	if len(s) == 0 {
		return 0, false, nil
	}
	fsp, err = CheckFsp(fsp)
	if err != nil {
		return 0, false, errors.Trace(err)
	}
	if fsp >= len(s) {
		tmp, e := strconv.ParseInt(s, 10, 64)
		if e != nil {
			return 0, false, errors.Trace(e)
		}
		v = int(float64(tmp) * math.Pow10(MaxFsp-len(s)))
		return
	}
	tmp, e := strconv.ParseInt(s[:fsp+1], 10, 64)
	if e != nil {
		return 0, false, errors.Trace(e)
	}
	tmp = (tmp + 5) / 10
	if float64(tmp) >= math.Pow10(fsp) {
		return 0, true, nil
	}
	v = int(float64(tmp) * math.Pow10(MaxFsp-fsp))
	return
}
ParseFrac parses the input string according to fsp, returns the microsecond,
and also a bool value to indice overflow. eg:
"999" fsp=2 will overflow.
package types
import (
	"math"
	"strconv"
	"strings"
	"github.com/pingcap/errors"
)
const (
	UnspecifiedFsp = -1
	MaxFsp = 6
	MinFsp = 0
	DefaultFsp = 0
)
func CheckFsp(fsp int) (int, error) {
	if fsp == UnspecifiedFsp {
		return DefaultFsp, nil
	}
	if fsp < MinFsp || fsp > MaxFsp {
		return DefaultFsp, errors.Errorf("Invalid fsp %d", fsp)
	}
	return fsp, nil
}