diff --git a/strftime/strftime.go b/strftime/strftime.go index f9f6af7..1cb1af7 100644 --- a/strftime/strftime.go +++ b/strftime/strftime.go @@ -44,25 +44,3 @@ func Strftime(format string, t time.Time) (string, error) { } return C.GoString(&cOut[0]), nil } - -// Strptime wraps the C strptime function -// func Strptime(format, s string) (time.Time, error) { -// var ( -// tm = C.struct_tm{} -// cFormat = C.CString(format) -// cin = C.CString(s) -// ) -// defer C.free(unsafe.Pointer(cin)) // nolint: gas -// defer C.free(unsafe.Pointer(cFormat)) // nolint: gas -// ptr := C.strptime(cin, cFormat, &tm) -// if ptr == nil { -// var zero time.Time -// return zero, &time.ParseError{ -// Layout: format, -// Value: s, -// LayoutElem: format, -// ValueElem: s, -// } -// } -// return time.Date(int(tm.tm_year)+1900, time.Month(tm.tm_mon+1), int(tm.tm_mday), int(tm.tm_hour), int(tm.tm_min), int(tm.tm_sec), 0, time.UTC), nil -// } diff --git a/strftime/strftime_test.go b/strftime/strftime_test.go index b3614c9..26004be 100644 --- a/strftime/strftime_test.go +++ b/strftime/strftime_test.go @@ -100,20 +100,3 @@ func TestStrftime(t *testing.T) { require.Equalf(t, test.expect, s, test.format) } } - -// func TestStrptime(t *testing.T) { -// testCases := []struct{ format, in, expect string }{ -// {"%a, %b %d, %Y", "Thu, Jun 29, 2017", "29 Jun 17 00:00 +0000"}, -// {"%a, %b %d, %Y %H:%M", "Thu, Jun 29, 2017 15:30", "29 Jun 17 15:30 +0000"}, -// // {"%a, %b %d, %Y %H:%M %Z", "Thu, Jun 29, 2017 15:30 UTC", "29 Jun 17 15:30 +0000"}, -// } -// for _, test := range testCases { -// tm, err := Strptime(test.format, test.in) -// require.NoError(t, err) -// s := tm.Format(time.RFC822Z) -// require.Equal(t, test.expect, s) -// } - -// _, err := Strptime("%Y", "onvald") -// require.Error(t, err) -// }