Browse Source

api/types/time: remove DurationToSecondsString() utility as it's no longer used

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 năm trước cách đây
mục cha
commit
90647e22b2
2 tập tin đã thay đổi với 0 bổ sung38 xóa
  1. 0 12
      api/types/time/duration_convert.go
  2. 0 26
      api/types/time/duration_convert_test.go

+ 0 - 12
api/types/time/duration_convert.go

@@ -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)
-}

+ 0 - 26
api/types/time/duration_convert_test.go

@@ -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()
-		}
-	}
-}