Use _{start,finish}_time in TranscodeJob.
authorCarl Hetherington <cth@carlh.net>
Fri, 25 Aug 2023 23:14:20 +0000 (01:14 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 25 Aug 2023 23:14:20 +0000 (01:14 +0200)
src/lib/job.cc
src/lib/job.h
src/lib/transcode_job.cc

index bf0879d926ebb77d0cf9461af9aa8c52fd1d79bc..e37ca2aab91eb53d1f084b0d12b8a1bcee9ea20a 100644 (file)
@@ -57,7 +57,6 @@ using namespace dcpomatic;
 Job::Job (shared_ptr<const Film> film)
        : _film (film)
        , _state (NEW)
-       , _start_time (0)
        , _sub_start_time (0)
        , _progress (0)
 {
index 8edde68453bea67148af71e6fa28fb4dd168665b..dc5f7bc34074041b85536978aa8554dc336a9db4 100644 (file)
@@ -130,6 +130,9 @@ protected:
 
        std::shared_ptr<const Film> _film;
 
+       time_t _start_time = 0;
+       time_t _finish_time = 0;
+
 private:
 
        void run_wrapper ();
@@ -147,12 +150,9 @@ private:
        /** a message that should be given to the user when the job finishes */
        boost::optional<std::string> _message;
 
-       /** time that this job was started */
-       time_t _start_time;
        /** time that this sub-job was started */
        time_t _sub_start_time;
        std::string _sub_name;
-       time_t _finish_time = 0;
 
        /** mutex for _progress and _last_progress_update */
        mutable boost::mutex _progress_mutex;
index 6b1563b9b85da2b30a37f4a09e3b2cbd47a255b6..653040f4c949c91d4279d87f486e1b9e08e75e7d 100644 (file)
@@ -119,19 +119,14 @@ TranscodeJob::run ()
                        }
                }
 
-               struct timeval start;
-               gettimeofday (&start, 0);
                LOG_GENERAL_NC (N_("Transcode job starting"));
 
                DCPOMATIC_ASSERT (_encoder);
                _encoder->go ();
 
-               struct timeval finish;
-               gettimeofday (&finish, 0);
-
                float fps = 0;
-               if (finish.tv_sec != start.tv_sec) {
-                       fps = _encoder->frames_done() / (finish.tv_sec - start.tv_sec);
+               if (_finish_time != _start_time) {
+                       fps = _encoder->frames_done() / (_finish_time - _start_time);
                }
 
                LOG_GENERAL (N_("Transcode job completed successfully: %1 fps"), dcp::locale_convert<string>(fps, 2, true));