Skip to content

Commit

Permalink
removed unnecessary removal of timezone
Browse files Browse the repository at this point in the history
SQLiteTimestampFormats does not account for an explicit timezone suffix

Also dee1a37 commit expects a Z suffix to be not present
  • Loading branch information
sum12 committed Aug 3, 2018
1 parent cba271c commit bc71f0f
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"fmt"
"math"
"reflect"
"strings"
"sync"
"time"
"unsafe"
Expand Down Expand Up @@ -264,9 +263,8 @@ func callbackArgTime(v *C.sqlite3_value) (reflect.Value, error) {
var err error
c := (*C.char)(unsafe.Pointer(C.sqlite3_value_text(v)))
tv := C.GoString(c)
s := strings.TrimSuffix(tv, "Z")
for _, format := range SQLiteTimestampFormats {
if timeVal, err := time.ParseInLocation(format, s, time.UTC); err == nil {
if timeVal, err := time.ParseInLocation(format, tv, time.UTC); err == nil {
t = timeVal
break
}
Expand All @@ -275,11 +273,6 @@ func callbackArgTime(v *C.sqlite3_value) (reflect.Value, error) {
// The column is a time value, so return the zero time on parse failure.
t = time.Time{}
}
/*
if rc.s.c.loc != nil {
t = t.In(rc.s.c.loc)
}
*/
return reflect.ValueOf(t), nil
}

Expand Down

0 comments on commit bc71f0f

Please sign in to comment.