Skip to content

Commit b37fbd7

Browse files
committed
fix unix timestamps
1 parent 1f43ee8 commit b37fbd7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sql/types/datetime.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package types
1717
import (
1818
"context"
1919
"fmt"
20+
"math"
2021
"reflect"
2122
"time"
2223

@@ -45,10 +46,10 @@ var (
4546
datetimeTypeMinDatetime = time.Date(1000, 1, 1, 0, 0, 0, 0, time.UTC)
4647

4748
// datetimeTypeMaxTimestamp is the maximum representable Timestamp value, MYSQL: 2038-01-19 03:14:07.999999 (microseconds)
48-
datetimeTypeMaxTimestamp = time.Date(2038, 1, 19, 3, 14, 7, 999999000, time.UTC)
49+
datetimeTypeMaxTimestamp = time.Unix(math.MaxInt32, 999999000)
4950

5051
// datetimeTypeMinTimestamp is the minimum representable Timestamp value, MYSQL: 1970-01-01 00:00:01.000000 (microseconds)
51-
datetimeTypeMinTimestamp = time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC)
52+
datetimeTypeMinTimestamp = time.Unix(1, 0)
5253

5354
datetimeTypeMaxDate = time.Date(9999, 12, 31, 0, 0, 0, 0, time.UTC)
5455

0 commit comments

Comments
 (0)