Support dates prior to Unix Epoch on Linux #990
Closed
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.
This changes the
st_(a|m|c)time
fields on Linux toi64
fromu64
to support times before Unix Epoch.Before this change, downstream crates would see
i64
times that have been cast tou64
, which is unexpected as it then represents a time unimaginably far in the future.Review Notes
There are plenty of tests which explicitly cast these fields to
u64
for comparison, or convert them tou64
. These tests don't fail as for most current dates, the time fields won't be negative.It might be confusing to see this done and it's probably better to remove these casts or, if needed, cast to
i64
instead. For now I left the PR minimal though and hope you can guide me (or make the changes you need) depending on preferences. After all, I could just approach the issue from the perspective of one Platform with one particular issue, but Rustix supports so many platforms more that I can barely grasp what's right here 😅.