]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix FILETIME truncation on `archive_write_finish_entry()` on Windows (#2050)
authornooriro <noorirogit@gmail.com>
Thu, 8 Feb 2024 12:37:31 +0000 (21:37 +0900)
committerGitHub <noreply@github.com>
Thu, 8 Feb 2024 12:37:31 +0000 (13:37 +0100)
On Windows, `archive_write_finish_entry()` does not restore time
correctly.
It truncates the last digit of original FILETIME which is stored in the
archive.
This commit fixes this behavior.
See libarchive#2049 for detailed explanation on this issue.

libarchive/archive_write_disk_windows.c

index d87deeb99dfb34166f38ab3e3fe4963711b9ff3c..774151ae22b96a5b7634e6e140616fe3dc5af42e 100644 (file)
@@ -2594,7 +2594,7 @@ set_times(struct archive_write_disk *a,
 {
 #define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
 #define WINTIME(sec, nsec) ((Int32x32To64(sec, 10000000) + EPOC_TIME)\
-        + (((nsec)/1000)*10))
+        + ((nsec)/100))
 
        HANDLE hw = 0;
        ULARGE_INTEGER wintm;