using time.Duration for rateincrements and groupinterval

This commit is contained in:
Radu Ioan Fericean
2013-08-07 13:29:27 +03:00
parent 0785874357
commit c209dbfb9f
14 changed files with 99 additions and 83 deletions

View File

@@ -462,9 +462,9 @@ func (d *Destination) Restore(input string) error {
func (pg PriceGroups) Store() (result string, err error) {
for _, p := range pg {
result += strconv.FormatFloat(p.StartSecond, 'f', -1, 64) +
result += p.StartSecond.String() +
":" + strconv.FormatFloat(p.Value, 'f', -1, 64) +
":" + strconv.FormatFloat(p.RateIncrements, 'f', -1, 64) +
":" + p.RateIncrements.String() +
","
}
result = strings.TrimRight(result, ",")
@@ -478,7 +478,7 @@ func (pg *PriceGroups) Restore(input string) error {
if len(priceElements) != 3 {
continue
}
ss, err := strconv.ParseFloat(priceElements[0], 64)
ss, err := time.ParseDuration(priceElements[0])
if err != nil {
return err
}
@@ -486,7 +486,7 @@ func (pg *PriceGroups) Restore(input string) error {
if err != nil {
return err
}
ri, err := strconv.ParseFloat(priceElements[2], 64)
ri, err := time.ParseDuration(priceElements[2])
if err != nil {
return err
}