GetServerLocation returns timezone value set for the server.
(ctx *sql.Context)
| 155 | |
| 156 | // GetServerLocation returns timezone value set for the server. |
| 157 | func GetServerLocation(ctx *sql.Context) (*time.Location, error) { |
| 158 | if ctx == nil { |
| 159 | return time.Local, nil |
| 160 | } |
| 161 | val, err := ctx.GetSessionVariable(ctx, "timezone") |
| 162 | if err != nil { |
| 163 | return nil, err |
| 164 | } |
| 165 | |
| 166 | loc, _, _, err := convertTzToOffsetSecs(time.Now(), val.(string)) |
| 167 | return loc, err |
| 168 | } |
no test coverage detected