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

Method DivFloat

pkg/util/duration/duration.go:498–507  ·  view source on GitHub ↗

DivFloat returns a Duration representing a time length of d/x.

(x float64)

Source from the content-addressed store, hash-verified

496
497// DivFloat returns a Duration representing a time length of d/x.
498func (d Duration) DivFloat(x float64) Duration {
499 monthInt, monthFrac := math.Modf(float64(d.Months) / x)
500 dayInt, dayFrac := math.Modf((float64(d.Days) / x) + (monthFrac * DaysPerMonth))
501
502 return MakeDuration(
503 int64((float64(d.nanos)/x)+(dayFrac*float64(nanosInDay))),
504 int64(dayInt),
505 int64(monthInt),
506 )
507}
508
509// normalized returns a new Duration transformed using the equivalence rules.
510// Each quantity of days greater than the threshold is moved into months,

Callers 2

DivMethod · 0.95
eval.goFile · 0.80

Calls 1

MakeDurationFunction · 0.85

Tested by

no test coverage detected