summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-08-26 01:14:20 +0200
committerCarl Hetherington <cth@carlh.net>2023-08-26 01:14:20 +0200
commitd3455851f60ee6bc35ea4f314c62a7da51ce0d81 (patch)
tree5234f53e82bbc3b33d42d7da7e30878435e5c200
parent29e45a5b851a3117ef568c72a4aab068a80a3430 (diff)
Use _{start,finish}_time in TranscodeJob.
-rw-r--r--src/lib/job.cc1
-rw-r--r--src/lib/job.h6
-rw-r--r--src/lib/transcode_job.cc9
3 files changed, 5 insertions, 11 deletions
diff --git a/src/lib/job.cc b/src/lib/job.cc
index bf0879d92..e37ca2aab 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -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)
{
diff --git a/src/lib/job.h b/src/lib/job.h
index 8edde6845..dc5f7bc34 100644
--- a/src/lib/job.h
+++ b/src/lib/job.h
@@ -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;
diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc
index 6b1563b9b..653040f4c 100644
--- a/src/lib/transcode_job.cc
+++ b/src/lib/transcode_job.cc
@@ -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));