github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/api/types/time/duration_convert.go (about)

     1  package time // import "github.com/demonoid81/moby/api/types/time"
     2  
     3  import (
     4  	"strconv"
     5  	"time"
     6  )
     7  
     8  // DurationToSecondsString converts the specified duration to the number
     9  // seconds it represents, formatted as a string.
    10  func DurationToSecondsString(duration time.Duration) string {
    11  	return strconv.FormatFloat(duration.Seconds(), 'f', 0, 64)
    12  }