File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -961,10 +961,11 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
961
961
// large to be a reasonable timestamp in seconds.
962
962
if val > 1e12 || val < - 1e12 {
963
963
val *= int64 (time .Millisecond ) // convert ms to nsec
964
+ t = time .Unix (0 , val )
964
965
} else {
965
- val *= int64 ( time .Second ) // convert sec to nsec
966
+ t = time .Unix ( val , 0 )
966
967
}
967
- t = time . Unix ( 0 , val ) .UTC ()
968
+ t = t .UTC ()
968
969
if rc .s .c .loc != nil {
969
970
t = t .In (rc .s .c .loc )
970
971
}
Original file line number Diff line number Diff line change @@ -403,6 +403,7 @@ func TestTimestamp(t *testing.T) {
403
403
}{
404
404
{"nonsense" , time.Time {}},
405
405
{"0000-00-00 00:00:00" , time.Time {}},
406
+ {time.Time {}.Unix (), time.Time {}},
406
407
{timestamp1 , timestamp1 },
407
408
{timestamp2 .Unix (), timestamp2 .Truncate (time .Second )},
408
409
{timestamp2 .UnixNano () / int64 (time .Millisecond ), timestamp2 .Truncate (time .Millisecond )},
You can’t perform that action at this time.
0 commit comments