Replies: 2 comments
-
|
@TSSkyhits The StartMeasurement(start time) function updates the header start time at the first measurement. Note that the relative sample time can be negative (see pre-trig time setting). But the MDF file support storage of more than one measurement i.e. more than one DG block, so what is the start time of the second measurement? Was the measurement done in parallel or sequential? There are several approaches to solve the above problem.
The last solution is the simplest solution, at least for this MDF library but some other readers may not have the same MD comment (XML) support as this library. I have added some non-tested code below: InitMeasurement();
StartMeasurement(start_time);
// Do the measurement
StopMeasurement(stop_time);
DgComment dg_comment;
dg_comment.Comment(measurement description);
MdProperty start;
start.Name("StartTime");
start.DataType(MdDataType::MdDateTime);
start.Value(start_time); // Convert ns since 1970 to a ISO date time string
dg_comment.AddProperty(start);
MdProperty stop;
stop.Name("StopTime");
stop.DataType(MdDataType::MdDateTime);
stop.Value(stop_time);
dg_comment.AddProperty(stop);
// Add more key/value pairs about the measurement
data_group->SetDgComment(dg_comment);
FinalizeMeasurement()
|
Beta Was this translation helpful? Give feedback.
-
|
@TSSkyhits By adding the functionality to the FinalizeMeasurement() function. Basically it implements the above (previous message) function as the DG MD block comment rarely is used. Two new function that return the start and stop time for a DG block. These functions tries to find these times by analyzing the file. Plan A is to get the times from the DG MD block but if this fails, try the most common ways to find them as the above list. Should this be an acceptable solution? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When start/stop the measurement, a timestamp is set:
void MdfWriter::StartMeasurement(uint64_t start_time) {
write_state_ = WriteState::StartMeas;
start_time_ = start_time;
stop_time_ = 0; // Zero indicate not stopped
...
}
But when creating a reader of the mf4 data file, I can not find a API to get the start_time/stop_time directly. Is there a solution to read all these information?
Beta Was this translation helpful? Give feedback.
All reactions