我在DolphinDB databse中创建了如下流数据表:
st=streamTable(
array(LONG,0) as id,
array(TIMESTAMP,0) as ts,
array(DATETIME,0) as dt,
array(DOUBLE,0) as value
)
share(st,"demoSt")
我想在python中把当前系统时间写入流表,代码如下:
import dolphindb as ddb
import numpy as np
import pandas as pd
s = ddb.session()
c=s.connect("192.168.1.125", 8848, "admin", "123456")
s.run("tableInsert{demoSt}", [1,np.datetime64('now',"ms"),np.datetime64('now'),0.01 ])
运行后,我查询得到的数据如下图所示:
这里有2个问题,一个问题是np.datetime64('now',"ms")得到的毫秒数不对,它总是000;另一个问题是np.datetime64('now')得到的是utc时间,不是localtime。请问要得到正确的时间应该怎么实现?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…