workaround insane mtime on busted filesystems
This commit is contained in:
parent
59b9ade124
commit
be5a1fbd3e
1 changed files with 11 additions and 1 deletions
12
hast.py
12
hast.py
|
@ -115,7 +115,17 @@ class UniqueStore:
|
|||
pass
|
||||
|
||||
if not mtime:
|
||||
mtime = datetime.datetime.fromtimestamp(stat.st_mtime)
|
||||
try:
|
||||
mtime = datetime.datetime.fromtimestamp(stat.st_mtime)
|
||||
except ValueError:
|
||||
# fall back to ctime in case mtime is FUBAR
|
||||
self.log("%s: mtime (~%i) is out of range, falling back to ctime (~%i)" %(
|
||||
path,
|
||||
1970 + stat.st_mtime // (365.24*86400),
|
||||
1970 + stat.st_ctime // (365.24*86400)
|
||||
), self.log.tl.warn)
|
||||
|
||||
mtime = datetime.datetime.fromtimestamp(stat.st_ctime)
|
||||
|
||||
if preload:
|
||||
filename_str = filename_src
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue