AsBigInt converts a duration to a big.Int with the number of nanoseconds.
(dst *big.Int)
| 249 | |
| 250 | // AsBigInt converts a duration to a big.Int with the number of nanoseconds. |
| 251 | func (d Duration) AsBigInt(dst *big.Int) { |
| 252 | dst.SetInt64(d.Months) |
| 253 | dst.Mul(dst, bigDaysInMonth) |
| 254 | dst.Add(dst, big.NewInt(d.Days)) |
| 255 | dst.Mul(dst, bigNanosInDay) |
| 256 | // Uses rounded instead of nanos here to remove any on-disk nanos. |
| 257 | dst.Add(dst, big.NewInt(d.rounded())) |
| 258 | } |
| 259 | |
| 260 | const ( |
| 261 | hourNanos = uint64(time.Hour / time.Nanosecond) |
no test coverage detected