-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: set last access time with unspecified date time kind #879
Closed
xtopaz
wants to merge
5
commits into
TestableIO:main
from
xtopaz:bugfix/setLastWriteTimeWithUnspecifiedDateTimeKind
Closed
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
55ca1ab
Fix missing conversion call
xtopaz dbd1a6a
Add unit tests
xtopaz 6cc2b91
Merge branch 'main' into bugfix/setLastWriteTimeWithUnspecifiedDateTi…
xtopaz 86a509e
Merge branch 'main' into bugfix/setLastWriteTimeWithUnspecifiedDateTi…
xtopaz c939931
Adjust DateTimeKind.Unspecified
vbtig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also do this for the other
*TimeUtc
properties?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether
ToLocalTime
is correct here. I think we rather want something like this: https://github.com/dotnet/runtime/blob/96d1c8e3ba4bc94afdcf15ee2896a3bc984820e7/src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.cs#L108There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fgreinacher Sorry for the late reply, just got back from vacation.
All other
*TimeUtc
properties already contain theToLocalTime
call. This way the behavior has been unified.File.File.GetUtcDateTimeOffset
cannot be used because it is internal. However, this behaves analogously to the proposed implementation, since it takes Utc forDateTimeKind.Unspecified
.To be more precise, the preliminary conversion using
ToLocalTime
for values withDateTimeKind.Unspecified
assumes UTC. The subsequent implicit conversion toDateTimeOffset
then takes the time zone into account correctly. Thus the timestamps behave analogously to those inSystem.FileInfo
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fgreinacher I've incorporated the recent changes from #875 and all test look fine.