Skip to content

Commit

Permalink
Merge pull request #853 from fengzeroz/v2.2
Browse files Browse the repository at this point in the history
fix timestamp
  • Loading branch information
fengzeroz authored Oct 21, 2022
2 parents d74cb80 + 7cde4ef commit 8d97d6b
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 15 deletions.
8 changes: 0 additions & 8 deletions plugins/mqtt/command/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/base/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/base/neu_plugin_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions src/event/event_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.5
2.2.6

0 comments on commit 8d97d6b

Please sign in to comment.