Return ts in selected time zone offset.
This commit is contained in:
parent
530204c1a5
commit
16b4bd53f4
17
datapoint.go
17
datapoint.go
@ -340,15 +340,28 @@ func DatapointDelete(id int) (err error) { // {{{
|
||||
return
|
||||
} // }}}
|
||||
func DatapointValues(id int, from, to time.Time) (values []DatapointValue, err error) { // {{{
|
||||
_, err = service.Db.Conn.Exec(`SELECT set_config('timezone', $1, false)`, smonConfig.Timezone().String())
|
||||
if err != nil {
|
||||
err = werr.Wrap(err).WithData(smonConfig.Timezone().String())
|
||||
return
|
||||
}
|
||||
|
||||
rows, err := service.Db.Conn.Queryx(
|
||||
`
|
||||
SELECT *
|
||||
SELECT
|
||||
id,
|
||||
datapoint_id,
|
||||
ts,
|
||||
value_int,
|
||||
value_string,
|
||||
value_datetime
|
||||
FROM datapoint_value
|
||||
WHERE
|
||||
datapoint_id=$1 AND
|
||||
ts >= $2 AND
|
||||
ts <= $3
|
||||
ORDER BY ts DESC
|
||||
ORDER BY
|
||||
ts DESC
|
||||
`,
|
||||
id,
|
||||
from,
|
||||
|
Loading…
Reference in New Issue
Block a user