Repository navigation
Translate DateTime.Millisecond on SQLite without floating-point trunation - #39382
Merged
AndriySvyryd merged 1 commit intoOct 22, 2026
Merged
AndriySvyryd merged 1 commit into
AndriySvyryd merged 1 commit into
Conversation
…ation
The translation multiplied the REAL value of strftime('%f') by 1000 and
took a truncating modulo, so values not exactly representable as a double
lost a millisecond (e.g. 01.005 returned 4 instead of 5). Read the
millisecond digits directly instead.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues were identified, and all readiness assessments approve the changes.
No open issues 🎉
What changed in this PR
This pull request fixes SQLite translation of DateTime.Millisecond by extracting millisecond digits directly from strftime('%f'), avoiding floating-point precision loss.
Changes:
- Replaced floating-point multiplication and truncation with text-based extraction and integer conversion.
- Updated affected SQLite SQL baselines.
- Added regression coverage for values such as
1.005seconds.
| File | Description |
|---|---|
test/EFCore.Sqlite.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsSqliteTest.cs |
Updates the temporal translation SQL baseline. |
test/EFCore.Sqlite.FunctionalTests/Query/NorthwindSelectQuerySqliteTest.cs |
Updates the millisecond projection SQL baseline. |
test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs |
Updates composed-query baselines and adds floating-point precision regression coverage. |
src/EFCore.Sqlite.Core/Query/Internal/Translators/SqliteDateTimeMemberTranslator.cs |
Implements precise millisecond extraction for SQLite DateTime.Millisecond. |
Review effort: Lite
AndriySvyryd
approved these changes
Oct 22, 2026
AndriySvyryd
left a comment
Member
There was a problem hiding this comment.
Thanks for your contribution!
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 applied 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.
The translation multiplied the REAL value of strftime('%f') by 1000 and took a truncating modulo, so values not exactly representable as a double lost a millisecond (e.g. 01.005 returned 4 instead of 5). Read the millisecond digits directly instead.