Blob Blame History Raw
From dabda2823a0d161ff448fc5596c4c06fe3bb17e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 3 Jul 2018 12:46:04 +0200
Subject: [PATCH] Fix access to mtime attribute of libarchive entry

python-libarchive-c supports nanosecond timestamps by returning a float
if the nanoseconds are not 0.
See https://github.com/Changaco/python-libarchive-c/commit/d6a2ea3803e8b6a5aec30308a48501d281badbee.
There is no mtime_nsec attribute.
---
 diffoscope/comparators/utils/libarchive.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diffoscope/comparators/utils/libarchive.py b/diffoscope/comparators/utils/libarchive.py
index f45092d40f..aebcaa320b 100644
--- a/diffoscope/comparators/utils/libarchive.py
+++ b/diffoscope/comparators/utils/libarchive.py
@@ -96,7 +96,7 @@ def list_libarchive(path):
             else:
                 size_or_dev = entry.size
             mtime = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(entry.mtime)
-                                  ) + '.{:06d}'.format(entry.mtime_nsec // 1000)
+                                  ) + '.{:06d}'.format(entry.mtime % 1000)
             if entry.issym:
                 name_and_link = '{entry.name} -> {entry.linkname}'.format(
                     entry=entry)