A Duration represents a length of time. A duration of "1 month" cannot be represented as a fixed number of nanoseconds because the length of months vary. The same is true for days because of leap seconds. Given a begin or end time to anchor a duration, the nanosecond count can be calculated, but it
| 103 | // TODO(dan): Until the overflow and underflow handling is fixed, this is only |
| 104 | // useful for durations of < 292 years. |
| 105 | type Duration struct { |
| 106 | Months int64 |
| 107 | Days int64 |
| 108 | // nanos is an unexported field so that it cannot be misused by other |
| 109 | // packages. It should almost always be rounded to the nearest microsecond. |
| 110 | nanos int64 |
| 111 | } |
| 112 | |
| 113 | // MakeDuration returns a Duration rounded to the nearest microsecond. |
| 114 | func MakeDuration(nanos, days, months int64) Duration { |
nothing calls this directly
no outgoing calls
no test coverage detected