mirror of git://sigrok.org/pulseview
Session: Record acquisition start time and use it when saving
This commit is contained in:
parent
e3faae50d5
commit
105ecffd86
|
@ -829,6 +829,8 @@ void Session::start_capture(function<void (const QString)> 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_;
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <glibmm/datetime.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
|
@ -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_;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue