Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
fc339fc3
authored
2013-12-21 21:00:29 +0800
by
slene
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
orm detect mysql timezone #403
1 parent
2c868a95
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
orm/db_alias.go
orm/db_alias.go
View file @
fc339fc
...
...
@@ -126,7 +126,15 @@ func RegisterDataBase(aliasName, driverName, dataSource string, params ...int) {
row
:=
al
.
DB
.
QueryRow
(
"SELECT @@session.time_zone"
)
var
tz
string
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
)
if
err
==
nil
{
al
.
TZ
=
t
.
Location
()
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment