From: Soeren Apel Date: Sat, 21 Oct 2023 20:28:10 +0000 (+0200) Subject: Session: Record acquisition start time and use it when saving X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=105ecffd86f20a153ab32769a54134e3ad859a09;p=pulseview.git Session: Record acquisition start time and use it when saving --- diff --git a/pv/session.cpp b/pv/session.cpp index 0e17a07b..f1a153e7 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -829,6 +829,8 @@ void Session::start_capture(function error_handler) name_changed(); } + acq_start_time_ = Glib::DateTime::create_now_local(); + // Begin the session sampling_thread_ = std::thread(&Session::sample_thread_proc, this, error_handler); } @@ -923,6 +925,11 @@ double Session::get_samplerate() const return samplerate; } +Glib::DateTime Session::get_acquisition_start_time() const +{ + return acq_start_time_; +} + uint32_t Session::get_highest_segment_id() const { return highest_segment_id_; diff --git a/pv/session.hpp b/pv/session.hpp index ba48a407..94338c20 100644 --- a/pv/session.hpp +++ b/pv/session.hpp @@ -35,6 +35,8 @@ #include #include +#include + #include #include #include @@ -185,6 +187,7 @@ public: void stop_capture(); double get_samplerate() const; + Glib::DateTime get_acquisition_start_time() const; uint32_t get_highest_segment_id() const; uint64_t get_segment_sample_count(uint32_t segment_id) const; @@ -312,6 +315,7 @@ private: bool frame_began_; QElapsedTimer acq_time_; + Glib::DateTime acq_start_time_; MetadataObjManager metadata_obj_manager_; diff --git a/pv/storesession.cpp b/pv/storesession.cpp index 8aaeff6f..5eb6a8ad 100644 --- a/pv/storesession.cpp +++ b/pv/storesession.cpp @@ -185,8 +185,7 @@ bool StoreSession::start() any_segment->samplerate())}}); output_->receive(meta); - Glib::DateTime start_time; - auto header = context->create_header_packet(start_time); + auto header = context->create_header_packet(session_.get_acquisition_start_time()); output_->receive(header); } catch (Error& error) { error_ = tr("Error while saving: ") + error.what();