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

Function MakeDTimestamp

postgres/parser/sem/tree/datum.go:985–991  ·  view source on GitHub ↗

MakeDTimestamp creates a DTimestamp with specified precision.

(t time.Time, precision time.Duration)

Source from the content-addressed store, hash-verified

983
984// MakeDTimestamp creates a DTimestamp with specified precision.
985func MakeDTimestamp(t time.Time, precision time.Duration) (*DTimestamp, error) {
986 ret := t.Round(precision)
987 if ret.After(MaxSupportedTime) || ret.Before(MinSupportedTime) {
988 return nil, errors.Newf("timestamp out of range: %q", ret.Format(time.RFC3339))
989 }
990 return &DTimestamp{Time: ret}, nil
991}
992
993// MustMakeDTimestamp wraps MakeDTimestamp but panics if there is an error.
994// This is intended for testing applications only.

Callers 3

MustMakeDTimestampFunction · 0.85
ParseDTimestampFunction · 0.85
RoundMethod · 0.85

Calls 4

AfterMethod · 0.80
BeforeMethod · 0.80
FormatMethod · 0.65
RoundMethod · 0.45

Tested by

no test coverage detected