Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
fc339fc3
Commit
fc339fc3
authored
Dec 21, 2013
by
slene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
orm detect mysql timezone #403
parent
2c868a95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
db_alias.go
orm/db_alias.go
+9
-1
No files found.
orm/db_alias.go
View file @
fc339fc3
...
@@ -126,7 +126,15 @@ func RegisterDataBase(aliasName, driverName, dataSource string, params ...int) {
...
@@ -126,7 +126,15 @@ func RegisterDataBase(aliasName, driverName, dataSource string, params ...int) {
row
:=
al
.
DB
.
QueryRow
(
"SELECT @@session.time_zone"
)
row
:=
al
.
DB
.
QueryRow
(
"SELECT @@session.time_zone"
)
var
tz
string
var
tz
string
row
.
Scan
(
&
tz
)
row
.
Scan
(
&
tz
)
if
tz
!=
"SYSTEM"
{
if
tz
==
"SYSTEM"
{
tz
=
""
row
=
al
.
DB
.
QueryRow
(
"SELECT @@system_time_zone"
)
row
.
Scan
(
&
tz
)
t
,
err
:=
time
.
Parse
(
"MST"
,
tz
)
if
err
==
nil
{
al
.
TZ
=
t
.
Location
()
}
}
else
{
t
,
err
:=
time
.
Parse
(
"-07:00"
,
tz
)
t
,
err
:=
time
.
Parse
(
"-07:00"
,
tz
)
if
err
==
nil
{
if
err
==
nil
{
al
.
TZ
=
t
.
Location
()
al
.
TZ
=
t
.
Location
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment