diff --git a/orm/db_alias.go b/orm/db_alias.go index c7089239..a43e70e3 100644 --- a/orm/db_alias.go +++ b/orm/db_alias.go @@ -119,7 +119,7 @@ type alias struct { func detectTZ(al *alias) { // orm timezone system match database // default use Local - al.TZ = time.Local + al.TZ = DefaultTimeLoc if al.DriverName == "sphinx" { return @@ -136,7 +136,9 @@ func detectTZ(al *alias) { } t, err := time.Parse("-07:00:00", tz) if err == nil { - al.TZ = t.Location() + if t.Location().String() != "" { + al.TZ = t.Location() + } } else { DebugLog.Printf("Detect DB timezone: %s %s\n", tz, err.Error()) }