stellar support monotonic time and real time

This commit is contained in:
luwenpeng
2024-05-16 10:13:43 +08:00
parent 1ef82a0c6a
commit fdc65067b2
30 changed files with 201 additions and 124 deletions

View File

@@ -8,8 +8,8 @@
#include <netinet/tcp.h>
#include "logo.h"
#include "times.h"
#include "config.h"
#include "timestamp.h"
#include "id_generator.h"
#include "stellar_priv.h"
#include "session_priv.h"
@@ -377,7 +377,7 @@ int main(int argc, char **argv)
return -1;
}
timestamp_update();
stellar_update_time_cache();
signal(SIGINT, signal_handler);
signal(SIGQUIT, signal_handler);
@@ -437,13 +437,13 @@ int main(int argc, char **argv)
goto error_out;
}
runtime->stat_last_output_ts = timestamp_get_msec();
runtime->stat_last_output_ts = stellar_get_monotonic_time_msec();
while (!ATOMIC_READ(&runtime->need_exit))
{
timestamp_update();
if (timestamp_get_msec() - runtime->stat_last_output_ts > 2000)
stellar_update_time_cache();
if (stellar_get_monotonic_time_msec() - runtime->stat_last_output_ts > 2000)
{
runtime->stat_last_output_ts = timestamp_get_msec();
runtime->stat_last_output_ts = stellar_get_monotonic_time_msec();
stellar_stat_output(runtime->stat);
}
usleep(1000); // 1ms