mirror of
https://github.com/Threnklyn/zeit.git
synced 2026-06-03 20:28:29 +02:00
Fixed indentation
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
package z
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
var fractional bool
|
||||
|
||||
func fmtDuration(dur time.Duration) (string) {
|
||||
return fmtHours(decimal.NewFromFloat(dur.Hours()))
|
||||
return fmtHours(decimal.NewFromFloat(dur.Hours()))
|
||||
}
|
||||
|
||||
func fmtHours(hours decimal.Decimal) (string) {
|
||||
if fractional {
|
||||
return hours.StringFixed(2)
|
||||
} else {
|
||||
return fmt.Sprintf(
|
||||
"%s:%02s",
|
||||
hours.Floor(), // hours
|
||||
if fractional {
|
||||
return hours.StringFixed(2)
|
||||
} else {
|
||||
return fmt.Sprintf(
|
||||
"%s:%02s",
|
||||
hours.Floor(), // hours
|
||||
hours.Sub(hours.Floor()).
|
||||
Mul(decimal.NewFromFloat(.6)).
|
||||
Mul(decimal.NewFromInt(100)).
|
||||
Floor())
|
||||
}
|
||||
Mul(decimal.NewFromFloat(.6)).
|
||||
Mul(decimal.NewFromInt(100)).
|
||||
Floor())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user