MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / AsBigInt

Method AsBigInt

pkg/util/duration/duration.go:251–258  ·  view source on GitHub ↗

AsBigInt converts a duration to a big.Int with the number of nanoseconds.

(dst *big.Int)

Source from the content-addressed store, hash-verified

249
250// AsBigInt converts a duration to a big.Int with the number of nanoseconds.
251func (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
260const (
261 hourNanos = uint64(time.Hour / time.Nanosecond)

Callers 1

PerformCastFunction · 0.80

Calls 3

roundedMethod · 0.95
MulMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected