* @brief Closes the MDF4 file */
| 166 | * @brief Closes the MDF4 file |
| 167 | */ |
| 168 | void MDF4::ExportWorker::closeResources() |
| 169 | { |
| 170 | if (isResourceOpen() && m_writer) { |
| 171 | try { |
| 172 | const auto steadyNow = DataModel::TimestampedFrame::SteadyClock::now(); |
| 173 | const auto steadyOffset = steadyNow - m_steadyBaseline; |
| 174 | const auto systemTime = m_systemBaseline + steadyOffset; |
| 175 | const auto stop_time = |
| 176 | std::chrono::duration_cast<std::chrono::nanoseconds>(systemTime.time_since_epoch()).count(); |
| 177 | |
| 178 | m_writer->StopMeasurement(static_cast<uint64_t>(stop_time)); |
| 179 | m_writer->FinalizeMeasurement(); |
| 180 | } catch (const std::exception& e) { |
| 181 | qWarning() << "[MDF4] Exception in closeResources:" << e.what(); |
| 182 | } |
| 183 | |
| 184 | m_fileOpen = false; |
| 185 | m_writer.reset(); |
| 186 | m_groupMap.clear(); |
| 187 | DataModel::clear_frame(m_templateFrame); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * @brief Stores the schema template frame; must run on the worker thread (queued invoke) so |
nothing calls this directly
no test coverage detected