Cleanup: use seconds() method.
authorCarl Hetherington <cth@carlh.net>
Thu, 4 Nov 2021 22:25:21 +0000 (23:25 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 13 Nov 2021 21:53:55 +0000 (22:53 +0100)
src/lib/job.cc

index 52558046ae8ec66ecd580194bf3f51558efd504e..cb2120de1ea492fb907f3a74d5653a3f007739eb 100644 (file)
@@ -376,8 +376,7 @@ Job::set_progress (float p, bool force)
                struct timeval now;
                gettimeofday (&now, 0);
                if (_last_progress_update && _last_progress_update->tv_sec > 0) {
                struct timeval now;
                gettimeofday (&now, 0);
                if (_last_progress_update && _last_progress_update->tv_sec > 0) {
-                       double const elapsed = (now.tv_sec + now.tv_usec / 1000000.0)
-                               - (_last_progress_update->tv_sec + _last_progress_update->tv_usec / 1000000.0);
+                       double const elapsed = seconds(now) - seconds(*_last_progress_update);
                        if (elapsed < 0.5) {
                                return;
                        }
                        if (elapsed < 0.5) {
                                return;
                        }