roundAndCheck rounds the given time to the specified precision and checks if the rounded time is within the supported bounds. Supported bounds: - [MinSupportedTime, MaxSupportedTime] - TimeInfinity - TimeNegativeInfinity
(t time.Time, precision time.Duration)
| 2888 | // - TimeInfinity |
| 2889 | // - TimeNegativeInfinity |
| 2890 | func roundAndCheck(t time.Time, precision time.Duration) (time.Time, error) { |
| 2891 | ret := t.Round(precision) |
| 2892 | if ret.After(MaxSupportedTime) || ret.Before(MinSupportedTime) { |
| 2893 | if t == pgdate.TimeInfinity || t == pgdate.TimeNegativeInfinity { |
| 2894 | return t, nil |
| 2895 | } |
| 2896 | |
| 2897 | return time.Time{}, NewTimestampExceedsBoundsError(ret) |
| 2898 | } |
| 2899 | return ret, nil |
| 2900 | } |
| 2901 | |
| 2902 | // MakeDTimestampTZ creates a DTimestampTZ with specified precision. |
| 2903 | func MakeDTimestampTZ(t time.Time, precision time.Duration) (_ *DTimestampTZ, err error) { |
no test coverage detected
searching dependent graphs…