MakeDTimestampTZ creates a DTimestampTZ with specified precision.
(t time.Time, precision time.Duration)
| 1069 | |
| 1070 | // MakeDTimestampTZ creates a DTimestampTZ with specified precision. |
| 1071 | func MakeDTimestampTZ(t time.Time, precision time.Duration) (*DTimestampTZ, error) { |
| 1072 | ret := t.Round(precision) |
| 1073 | if ret.After(MaxSupportedTime) || ret.Before(MinSupportedTime) { |
| 1074 | return nil, errors.Newf("timestamp %q exceeds supported timestamp bounds", ret.Format(time.RFC3339)) |
| 1075 | } |
| 1076 | return &DTimestampTZ{Time: ret}, nil |
| 1077 | } |
| 1078 | |
| 1079 | // MustMakeDTimestampTZ wraps MakeDTimestampTZ but panics if there is an error. |
| 1080 | // This is intended for testing applications only. |
no test coverage detected