MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / MulFloat

Method MulFloat

pkg/util/duration/duration.go:486–495  ·  view source on GitHub ↗

MulFloat returns a Duration representing a time length of d*x.

(x float64)

Source from the content-addressed store, hash-verified

484
485// MulFloat returns a Duration representing a time length of d*x.
486func (d Duration) MulFloat(x float64) Duration {
487 monthInt, monthFrac := math.Modf(float64(d.Months) * x)
488 dayInt, dayFrac := math.Modf((float64(d.Days) * x) + (monthFrac * DaysPerMonth))
489
490 return MakeDuration(
491 int64((float64(d.nanos)*x)+(dayFrac*float64(nanosInDay))),
492 int64(dayInt),
493 int64(monthInt),
494 )
495}
496
497// DivFloat returns a Duration representing a time length of d/x.
498func (d Duration) DivFloat(x float64) Duration {

Callers 2

sqlStdToDurationFunction · 0.80
eval.goFile · 0.80

Calls 1

MakeDurationFunction · 0.85

Tested by

no test coverage detected