diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2015-03-04 22:58:32 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2015-03-04 22:58:32 +0900 |
commit | 18aa166fa96a695c5e520d9411d1208e655812d0 (patch) | |
tree | a44df9730c8f2403efd07d8a1db220b4ed7fdd3a | |
parent | Add loc=XXX parameters to handle timezone (diff) | |
download | golite-18aa166fa96a695c5e520d9411d1208e655812d0.tar.gz golite-18aa166fa96a695c5e520d9411d1208e655812d0.tar.xz |
cleanup code
-rw-r--r-- | sqlite3.go | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -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 { |