Repository navigation
mf4: derive measurement start from the first record - #81
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applie
2EE0
d or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MF4 exports currently require callers to choose a start time before writing records. Exporting buffered capture data can then reject the first record because its timestamp predates that manually chosen start.
Derive the measurement start from the first accepted frame or event, giving that record offset zero. Patch the existing header through the seekable output; empty exports retain file creation time. Invalid records leave the start unset, and header-patch failures remain sticky. Subsequent records before the established start and regressions within a bus/frame-kind group are still rejected.
The constructor is now
mf4.NewWriter(output, options); callers must remove the start argument.Validation:
go test -race ./...,go vet ./..., formatting and diff checks passed.Independent-reader acceptance is interoperability evidence; Vector, MATLAB and CANape conformance checks were unavailable.
Note
Medium Risk
Breaking constructor API and changes how MF4 absolute timestamps are chosen, which affects any external callers and downstream tooling that assumed a caller-supplied start.
Overview
mf4 no longer takes an explicit measurement start:
NewWriteris nowNewWriter(output, options)(callers drop thestartargument).The first accepted frame or event sets the measurement start (offset zero) by patching the MDF header on the seekable output. Until then, and for empty exports, the header uses file creation time (shared with the history block). Rejected or invalid records and early Flush do not establish start; records before the chosen start still fail; per-bus time regression rules are unchanged.
New
timeOffsetcentralizes range checks and lazy start initialization.start_test.goadds regression coverage for frame/event-first starts, epoch origins, empty close, post-close writes, and sticky failures when header patching fails.Reviewed by Cursor Bugbot for commit 69d2373. Configure here.