Skip to content

Commit

Permalink
Changed CLOCK_MONOTONIC_RAW to CLOCK_MONOTONIC for Windows.
Browse files Browse the repository at this point in the history
Signed-off-by: hurrhnn <[email protected]>
  • Loading branch information
hurrhnn committed May 1, 2022
1 parent 67c99ed commit a2d6837
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ra_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@ void *provide_20ms_opus_sender(void *p_opus_sender_args) {

void *provide_20ms_opus_timer(void *p_opus_builder_cond) {
struct timespec start_timespec;
clock_gettime(CLOCK_MONOTONIC_RAW, &start_timespec);
clock_gettime(CLOCK_MONOTONIC, &start_timespec);
time_t start_time = (start_timespec.tv_sec * 1000000000L) + start_timespec.tv_nsec, time, offset = 0L, average = 0L;

while (!is_EOS) {
offset += 20000000L;
time = start_time + offset;

struct timespec current_time, calculated_delay;
clock_gettime(CLOCK_MONOTONIC_RAW, &current_time);
clock_gettime(CLOCK_MONOTONIC, &current_time);
time -= ((current_time.tv_sec * 1000000000L) + current_time.tv_nsec);

calculated_delay.tv_sec = ((time / 1000000000L) > 0 ? (time / 1000000000L) : 0);
Expand Down

0 comments on commit a2d6837

Please sign in to comment.