Skip to content

Commit 36ff276

Browse files
authored
Merge pull request #130 from alexingfds/DEV-519-remove-timezone-info-00-00-from-indexed-file-directory-times
Remove timezone info from indexed file and directory
2 parents c50eef6 + 34d7b67 commit 36ff276

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

diskover/diskover.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def get_tree_size(executor, thread, root, top, path, sizes, inodes, depth=0, max
475475

476476
# check for invalid time stamps
477477
try:
478-
mtime = datetime.fromtimestamp(int(f_stat.st_mtime), timezone.utc).isoformat()
478+
mtime = datetime.fromtimestamp(int(f_stat.st_mtime), timezone.utc).replace(tzinfo=None).isoformat()
479479
except ValueError:
480480
logmsg = '[{0}] MTIME TIMESTAMP WARNING {1}'.format(thread, os.path.join(parent_path, file_name))
481481
logger.warning(logmsg)
@@ -486,7 +486,7 @@ def get_tree_size(executor, thread, root, top, path, sizes, inodes, depth=0, max
486486
pass
487487

488488
try:
489-
atime = datetime.fromtimestamp(int(f_stat.st_atime), tz=timezone.utc).isoformat()
489+
atime = datetime.fromtimestamp(int(f_stat.st_atime), tz=timezone.utc).replace(tzinfo=None).isoformat()
490490
except ValueError:
491491
logmsg = '[{0}] ATIME TIMESTAMP WARNING {1}'.format(thread, os.path.join(parent_path, file_name))
492492
logger.warning(logmsg)
@@ -497,7 +497,7 @@ def get_tree_size(executor, thread, root, top, path, sizes, inodes, depth=0, max
497497
pass
498498

499499
try:
500-
ctime = datetime.fromtimestamp(int(f_stat.st_ctime), timezone.utc).isoformat()
500+
ctime = datetime.fromtimestamp(int(f_stat.st_ctime), timezone.utc).replace(tzinfo=None).isoformat()
501501
except ValueError:
502502
logmsg = '[{0}] CTIME TIMESTAMP WARNING {1}'.format(thread, os.path.join(parent_path, file_name))
503503
logger.warning(logmsg)
@@ -636,7 +636,7 @@ def get_tree_size(executor, thread, root, top, path, sizes, inodes, depth=0, max
636636

637637
# handle timestamp errors in s3fs and possibly other fuse mounts
638638
try:
639-
mtime = datetime.fromtimestamp(int(d_stat.st_mtime), timezone.utc).isoformat()
639+
mtime = datetime.fromtimestamp(int(d_stat.st_mtime), timezone.utc).replace(tzinfo=None).isoformat()
640640
except ValueError:
641641
logmsg = '[{0}] MTIME TIMESTAMP WARNING {1}'.format(thread, os.path.join(parent_path, file_name))
642642
logger.warning(logmsg)
@@ -647,7 +647,7 @@ def get_tree_size(executor, thread, root, top, path, sizes, inodes, depth=0, max
647647
pass
648648

649649
try:
650-
atime = datetime.fromtimestamp(int(d_stat.st_atime), timezone.utc).isoformat()
650+
atime = datetime.fromtimestamp(int(d_stat.st_atime), timezone.utc).replace(tzinfo=None).isoformat()
651651
except ValueError:
652652
logmsg = '[{0}] ATIME TIMESTAMP WARNING {1}'.format(thread, os.path.join(parent_path, file_name))
653653
logger.warning(logmsg)
@@ -658,7 +658,7 @@ def get_tree_size(executor, thread, root, top, path, sizes, inodes, depth=0, max
658658
pass
659659

660660
try:
661-
ctime = datetime.fromtimestamp(int(d_stat.st_ctime), timezone.utc).isoformat()
661+
ctime = datetime.fromtimestamp(int(d_stat.st_ctime), timezone.utc).replace(tzinfo=None).isoformat()
662662
except ValueError:
663663
logmsg = '[{0}] CTIME TIMESTAMP WARNING {1}'.format(thread, os.path.join(parent_path, file_name))
664664
logger.warning(logmsg)

0 commit comments

Comments
 (0)