mirror of
https://github.com/emqx/neuron.git
synced 2026-10-17 04:40:42 +08:00
fix timestamp
This commit is contained in:
@@ -23,14 +23,6 @@
|
||||
|
||||
#include "read_write.h"
|
||||
|
||||
// static uint64_t current_time()
|
||||
// {
|
||||
// struct timeval tv;
|
||||
// gettimeofday(&tv, NULL);
|
||||
// uint64_t ms = tv.tv_sec;
|
||||
// return ms * 1000 + tv.tv_usec / 1000;
|
||||
// }
|
||||
|
||||
int command_rw_read_once_request(neu_plugin_t *plugin, neu_json_mqtt_t *mqtt,
|
||||
neu_json_read_req_t *req)
|
||||
{
|
||||
|
||||
@@ -815,7 +815,7 @@ static int update_timestamp(void *usr_data)
|
||||
uint64_t timestamp = 0;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
timestamp = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
timestamp = (int64_t) tv.tv_sec * 1000 + (int64_t) tv.tv_usec / 1000;
|
||||
adapter->timestamp = timestamp;
|
||||
|
||||
neu_plugin_to_plugin_common(adapter->plugin)->timestamp = timestamp;
|
||||
|
||||
+1
-1
@@ -256,7 +256,7 @@ static void update_timestamp(neu_group_t *group)
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
group->timestamp = tv.tv_sec * 1000 * 1000 + tv.tv_usec;
|
||||
group->timestamp = (int64_t) tv.tv_sec * 1000 * 1000 + (int64_t) tv.tv_usec;
|
||||
}
|
||||
|
||||
static UT_array *to_array(tag_elem_t *tags)
|
||||
|
||||
@@ -32,7 +32,8 @@ void neu_plugin_common_init(neu_plugin_common_t *common)
|
||||
common->magic = NEU_PLUGIN_MAGIC_NUMBER;
|
||||
common->link_state = NEU_NODE_LINK_STATE_DISCONNECTED;
|
||||
common->tag_size = 0;
|
||||
common->timestamp = time(NULL) * 1000; // don't need much precision at init
|
||||
common->timestamp = time(NULL);
|
||||
common->timestamp *= 1000; // don't need much precision at init
|
||||
}
|
||||
|
||||
bool neu_plugin_common_check(neu_plugin_t *plugin)
|
||||
|
||||
@@ -103,10 +103,7 @@ static void *event_loop(void *arg)
|
||||
assert(size != -1);
|
||||
|
||||
nng_mtx_lock(data->ctx.timer->mtx);
|
||||
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, data->fd, NULL);
|
||||
ret = data->callback.timer(data->usr_data);
|
||||
timerfd_settime(data->fd, 0, &data->ctx.timer->value, NULL);
|
||||
epoll_ctl(epoll_fd, EPOLL_CTL_ADD, data->fd, &event);
|
||||
nng_mtx_unlock(data->ctx.timer->mtx);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user