src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

duration.go (350B)


      1 package timeconv
      2 
      3 import "time"
      4 
      5 // FloatSecondsDur converts a fractional seconds to duration.
      6 func FloatSecondsDur(v float64) time.Duration {
      7 	return time.Duration(v * float64(time.Second))
      8 }
      9 
     10 // DurSecondsFloat converts a duration into fractional seconds.
     11 func DurSecondsFloat(d time.Duration) float64 {
     12 	return float64(d) / float64(time.Second)
     13 }