MCPcopy Create free account
hub / github.com/dolthub/doltgresql / Duration

Struct Duration

postgres/parser/duration/duration.go:105–111  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

103// TODO(dan): Until the overflow and underflow handling is fixed, this is only
104// useful for durations of < 292 years.
105type 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.
114func MakeDuration(nanos, days, months int64) Duration {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected