|
@@ -39,6 +39,12 @@ func (d *Durafmt) Duration() time.Duration {
|
|
return d.duration
|
|
return d.duration
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// Truncate sets precision
|
|
|
|
+func (d *Durafmt) Truncate(unit time.Duration) *Durafmt {
|
|
|
|
+ d.duration = d.duration.Truncate(unit)
|
|
|
|
+ return d
|
|
|
|
+}
|
|
|
|
+
|
|
// Parse creates a new *Durafmt struct, returns error if input is invalid.
|
|
// Parse creates a new *Durafmt struct, returns error if input is invalid.
|
|
func Parse(dinput time.Duration) *Durafmt {
|
|
func Parse(dinput time.Duration) *Durafmt {
|
|
input := dinput.String()
|
|
input := dinput.String()
|