Skip to content

Commit

Permalink
Make sure CTime adds nanoseconds on Unix when retrieving info from disk.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossanlop committed Jun 22, 2022
1 parent c7a0923 commit cad5599
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ partial void ReadFileFromDiskAndWriteToArchiveStreamAsEntry(string fullPath, str

entry._header._mTime = info.LastWriteTimeUtc;
entry._header._aTime = info.LastAccessTimeUtc;
entry._header._cTime = TarHelpers.GetDateTimeOffsetFromSecondsSinceEpoch(status.CTime);
// FileSystemInfo does not have ChangeTime, but LastWriteTime and LastAccessTime make sure to add nanoseconds, so we should do the same here
entry._header._cTime = DateTimeOffset.FromUnixTimeSeconds(status.CTime).AddTicks(status.CTimeNsec / 100 /* nanoseconds per tick */);

entry._header._mode = (status.Mode & 4095); // First 12 bits

Expand Down

0 comments on commit cad5599

Please sign in to comment.