[SOLVED] InfluxQL: what is the difference between now() and UNIX timestamp?

Hello,

I have data with timestamps ranging between Aug 23, 2017 00:00:00 to Aug 25, 2017 07:50:35 (displays OK in Grafana) and I’m trying to manually get aggregate data in the influx CLI. Why is it that using "time <= " doesn’t work but “time <= now()” does?

A query with “start time” only:

> SELECT max(xmit_data),min(xmit_data),mean(xmit_data),stddev(xmit_data) FROM data WHERE hostname='mo79' AND time>=1503439200

name: data 
----------
time            max                     min             mean                    stddev
1503439200      6.80396506644e+11       2.94371092e+08  4.896211809081595e+11   3.0527230680530444e+11

A query with “end time” now():

> SELECT max(xmit_data),min(xmit_data),mean(xmit_data),stddev(xmit_data) FROM data WHERE hostname='mo79' AND time>1503439200 AND time<now()
name: data
----------
time            max                     min             mean                    stddev
1503439201      6.80396506644e+11       2.94371092e+08  4.896211809081595e+11   3.0527230680530444e+11

But this doesn’t work (empty result):

[influx@localhost ~]$ date +%s
1504624904

> SELECT max(xmit_data),min(xmit_data),mean(xmit_data),stddev(xmit_data) FROM data WHERE hostname='mo79' AND time>1503439200 AND time<1504624904

And it doesn’t seem to work for any timestamp between 1503439200 and now… Why ???

thanks
Marek

Can u run the query with the precision parameter e.g.

SELECT max(xmit_data),min(xmit_data),mean(xmit_data),stddev(xmit_data) FROM data WHERE hostname=‘mo79’ AND time > 1503439200s AND time < 1504624904s

The difference is inclusion of “s” at the end of epoch timestamps

That was it, thanks :sunny: