Decode reverses the three integers returned from Encode and produces an equal Duration to the original.
(sortNanos int64, months int64, days int64)
| 722 | // Decode reverses the three integers returned from Encode and produces an equal |
| 723 | // Duration to the original. |
| 724 | func Decode(sortNanos int64, months int64, days int64) (Duration, error) { |
| 725 | nanos := sortNanos - months*nanosInMonth - days*nanosInDay |
| 726 | // TODO(dan): Handle underflow, then document that DecodeBigInt can be used |
| 727 | // in underflow cases. |
| 728 | return Duration{Months: months, Days: days, nanos: nanos}, nil |
| 729 | } |
| 730 | |
| 731 | // TODO(dan): Write DecodeBigInt. |
| 732 |
no outgoing calls
no test coverage detected
searching dependent graphs…