optimizate: pass the current timeout to the ID generator as a parameter, instead of getting the time from the ID generator itself

This commit is contained in:
luwenpeng
2024-07-16 17:13:32 +08:00
parent 07ce636f64
commit b50f0c2c70
21 changed files with 197 additions and 201 deletions

View File

@@ -9,12 +9,11 @@ TEST(TIMES, TEST)
uint64_t curr_sec = 0;
uint64_t curr_msec = 0;
stellar_update_time_cache();
last_sec = stellar_get_monotonic_time_sec();
last_msec = stellar_get_monotonic_time_msec();
usleep(1000); // 1ms
stellar_update_time_cache();
curr_sec = stellar_get_monotonic_time_sec();
curr_msec = stellar_get_monotonic_time_msec();
printf("After usleep(1000)\n");
@@ -24,7 +23,7 @@ TEST(TIMES, TEST)
EXPECT_TRUE(curr_msec - last_msec >= 1);
usleep(1000 * 1000); // 1s
stellar_update_time_cache();
last_sec = curr_sec;
last_msec = curr_msec;
curr_sec = stellar_get_monotonic_time_sec();