mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
fix(vrtsim): handle CLOCK_REALTIME jump after PTP sync
Signed-off-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
This commit is contained in:
@@ -271,12 +271,14 @@ static void *vrtsim_timing_job(void *arg)
|
||||
LOG_E(UTIL, "clock_gettime failed\n");
|
||||
exit(1);
|
||||
}
|
||||
uint64_t diff = (current_time.tv_sec - vrtsim_state->start_ts.tv_sec) * 1000000000
|
||||
int64_t diff = (current_time.tv_sec - vrtsim_state->start_ts.tv_sec) * 1000000000
|
||||
+ (current_time.tv_nsec - vrtsim_state->start_ts.tv_nsec);
|
||||
double sample_index = vrtsim_state->sample_rate * vrtsim_state->timescale * diff / 1e9;
|
||||
int64_t samples_to_produce = sample_index - last_sample_index;
|
||||
shm_td_iq_channel_produce_samples(vrtsim_state->channel, samples_to_produce);
|
||||
last_sample_index = sample_index;
|
||||
if (samples_to_produce > 0) {
|
||||
shm_td_iq_channel_produce_samples(vrtsim_state->channel, samples_to_produce);
|
||||
last_sample_index = sample_index;
|
||||
}
|
||||
usleep(1);
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user