From: Steinar H. Gunderson Date: Tue, 23 Aug 2016 19:18:43 +0000 (+0200) Subject: Remove the last use of non-monotonic time. X-Git-Tag: 1.4.0~141 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=702ac6724875c125b73f929ab6939d06a0b28e3f Remove the last use of non-monotonic time. --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 68c446a..7d2a2d5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -303,13 +303,13 @@ void MainWindow::audio_level_callback(float level_lufs, float peak_db, float glo float gain_staging_db, float final_makeup_gain_db, float correlation) { - timeval now; - gettimeofday(&now, nullptr); + timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); // The meters are somewhat inefficient to update. Only update them // every 100 ms or so (we get updates every 5–20 ms). double last_update_age = now.tv_sec - last_audio_level_callback.tv_sec + - 1e-6 * (now.tv_usec - last_audio_level_callback.tv_usec); + 1e-9 * (now.tv_nsec - last_audio_level_callback.tv_nsec); if (last_update_age < 0.100) { return; } diff --git a/mainwindow.h b/mainwindow.h index 8110176..6b791f9 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -56,7 +56,7 @@ private: // Called from the mixer. void audio_level_callback(float level_lufs, float peak_db, float global_level_lufs, float range_low_lufs, float range_high_lufs, float gain_staging_db, float final_makeup_gain_db, float correlation); - timeval last_audio_level_callback{0, 0}; + timespec last_audio_level_callback{0, 0}; Ui::MainWindow *ui; QPushButton *transition_btn1, *transition_btn2, *transition_btn3;