Decode reverses the three integers returned from Encode and produces an equal Duration to the original.
(sortNanos int64, months int64, days int64)
| 399 | // Decode reverses the three integers returned from Encode and produces an equal |
| 400 | // Duration to the original. |
| 401 | func Decode(sortNanos int64, months int64, days int64) (Duration, error) { |
| 402 | nanos := sortNanos - months*nanosInMonth - days*nanosInDay |
| 403 | // TODO(dan): Handle underflow, then document that DecodeBigInt can be used |
| 404 | // in underflow cases. |
| 405 | return Duration{Months: months, Days: days, nanos: nanos}, nil |
| 406 | } |
| 407 | |
| 408 | // TODO(dan): Write DecodeBigInt. |
| 409 |
no outgoing calls
no test coverage detected
searching dependent graphs…