mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
api/types/time: remove DurationToSecondsString() utility as it's no longer used
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e8fa708ae5
commit
90647e22b2
2 changed files with 0 additions and 38 deletions
|
@ -1,12 +0,0 @@
|
|||
package time // import "github.com/docker/docker/api/types/time"
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// DurationToSecondsString converts the specified duration to the number
|
||||
// seconds it represents, formatted as a string.
|
||||
func DurationToSecondsString(duration time.Duration) string {
|
||||
return strconv.FormatFloat(duration.Seconds(), 'f', 0, 64)
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package time // import "github.com/docker/docker/api/types/time"
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestDurationToSecondsString(t *testing.T) {
|
||||
cases := []struct {
|
||||
in time.Duration
|
||||
expected string
|
||||
}{
|
||||
{0 * time.Second, "0"},
|
||||
{1 * time.Second, "1"},
|
||||
{1 * time.Minute, "60"},
|
||||
{24 * time.Hour, "86400"},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
s := DurationToSecondsString(c.in)
|
||||
if s != c.expected {
|
||||
t.Errorf("wrong value for input `%v`: expected `%s`, got `%s`", c.in, c.expected, s)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue