diff --git a/go/mysql/datetime/datetime.go b/go/mysql/datetime/datetime.go index b997f78ca97..973c79b44c3 100644 --- a/go/mysql/datetime/datetime.go +++ b/go/mysql/datetime/datetime.go @@ -778,14 +778,3 @@ func NewDateTimeFromStd(t time.Time) DateTime { Time: NewTimeFromStd(t), } } - -func NewDateTimeFromSeconds(seconds decimal.Decimal) DateTime { - secondsInt64, _ := seconds.Int64() - timeSeconds := secondsInt64 % (24 * 3600) - tt := NewTimeFromSeconds(decimal.NewFromInt(timeSeconds)) - d := DateFromDayNumber(int(secondsInt64 / (24 * 3600))) - return DateTime{ - Date: d, - Time: tt, - } -} diff --git a/go/mysql/datetime/datetime_test.go b/go/mysql/datetime/datetime_test.go index a88941897fe..697f967cc3c 100644 --- a/go/mysql/datetime/datetime_test.go +++ b/go/mysql/datetime/datetime_test.go @@ -569,32 +569,6 @@ func TestToSeconds(t *testing.T) { assert.Equal(t, 63877375780, int(res)) } -func TestFromSeconds(t *testing.T) { - { - tt := NewTimeFromSeconds(decimal.NewFromInt(45020)) - - assert.EqualValues(t, 12, tt.Hour()) - assert.EqualValues(t, 30, tt.Minute()) - assert.EqualValues(t, 20, tt.Second()) - - res := tt.ToSeconds() - assert.Equal(t, 45020, int(res)) - } - { - dt := NewDateTimeFromSeconds(decimal.NewFromInt(63877465820)) - - assert.EqualValues(t, 2024, dt.Date.Year()) - assert.EqualValues(t, 3, dt.Date.Month()) - assert.EqualValues(t, 12, dt.Date.Day()) - assert.EqualValues(t, 12, dt.Time.Hour()) - assert.EqualValues(t, 30, dt.Time.Minute()) - assert.EqualValues(t, 20, dt.Time.Second()) - - res := dt.ToSeconds() - assert.Equal(t, 63877465820, int(res)) - } -} - func TestToStdTime(t *testing.T) { testCases := []struct { year int