aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2015-03-04 22:58:32 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2015-03-04 22:58:32 +0900
commit18aa166fa96a695c5e520d9411d1208e655812d0 (patch)
treea44df9730c8f2403efd07d8a1db220b4ed7fdd3a
parentAdd loc=XXX parameters to handle timezone (diff)
downloadgolite-18aa166fa96a695c5e520d9411d1208e655812d0.tar.gz
golite-18aa166fa96a695c5e520d9411d1208e655812d0.tar.xz
cleanup code
-rw-r--r--sqlite3.go21
1 files changed, 8 insertions, 13 deletions
diff --git a/sqlite3.go b/sqlite3.go
index 4457798..e6584a4 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -572,19 +572,14 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
switch rc.decltype[i] {
case "timestamp", "datetime", "date":
- if rc.s.c.loc != nil {
- for _, format := range SQLiteTimestampFormats {
- if timeVal, err = time.ParseInLocation(format, s, rc.s.c.loc); err == nil {
- dest[i] = timeVal
- break
- }
- }
- } else {
- for _, format := range SQLiteTimestampFormats {
- if timeVal, err = time.ParseInLocation(format, s, time.UTC); err == nil {
- dest[i] = timeVal
- break
- }
+ zone := rc.s.c.loc
+ if zone == nil {
+ zone = time.UTC
+ }
+ for _, format := range SQLiteTimestampFormats {
+ if timeVal, err = time.ParseInLocation(format, s, zone); err == nil {
+ dest[i] = timeVal
+ break
}
}
if err != nil {