iotdb icon indicating copy to clipboard operation
iotdb copied to clipboard

时间戳只能使用毫秒

Open hyoHhh opened this issue 3 years ago • 2 comments

    IoTDB默认使用毫秒, 但是其实IoTDB内部是用的long进行存储的,因此可以通过配置来支持微秒和纳秒。

在IoTDB配置文件(iotdb-engine.properties)中的如下配置:

# Use this value to set timestamp precision as "ms", "us" or "ns".
# Once the precision is been set, it can not be changed.
timestamp_precision=ms

这样的话,你传入一个long时间戳,就会将其按照微秒或者纳秒解读了。 不过目前的版本中 now()返回的是毫秒值, 所以如果将timestamp_precision设置为us或者ns,那么时间将来解析成人类可读的时间(yyyy-mm-dd HH:MM:ss)就会不太对。 这个会马上加PR修复。

By default, IoTDB considers a long timestamp as millisecond time unit, but you can change it in iotdb-engine.properties: timestamp_precision=us or timestamp_precision=ns.

But currently, now() function only returns ms.

Originally posted by @jixuan1989 in https://github.com/apache/iotdb/issues/1276#issuecomment-634542829

hyoHhh avatar Oct 17 '22 03:10 hyoHhh

应该在0.12/0.13版本就支持了,可以尝试一下。

HTHou avatar Oct 17 '22 04:10 HTHou

应该在0.12/0.13版本就支持了,可以尝试一下。

用的就是13.2版本,14版本支持,我试了,要自己编译

hyoHhh avatar Oct 30 '22 11:10 hyoHhh