DivFloat returns a Duration representing a time length of d/x.
(x float64)
| 496 | |
| 497 | // DivFloat returns a Duration representing a time length of d/x. |
| 498 | func (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, |
no test coverage detected