]> git.sesse.net Git - nageru/commitdiff
Remove the last use of non-monotonic time.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 23 Aug 2016 19:18:43 +0000 (21:18 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 23 Aug 2016 19:19:21 +0000 (21:19 +0200)
mainwindow.cpp
mainwindow.h

index 68c446af8ed4b8921ede7b6339ba5af06b3193d5..7d2a2d511522b5a8c8ff7326f9dadbe135d10db4 100644 (file)
@@ -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;
        }
index 8110176c20412b272afd57669b2a128ab294ed67..6b791f9d4c0095da97e304353b3d862f800180fd 100644 (file)
@@ -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;