MulFloat returns a Duration representing a time length of d*x.
(x float64)
| 484 | |
| 485 | // MulFloat returns a Duration representing a time length of d*x. |
| 486 | func (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. |
| 498 | func (d Duration) DivFloat(x float64) Duration { |
no test coverage detected