github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/api/types/time/duration_convert.go (about)

     1  package 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  }