Skip to content

Commit

Permalink
Correct a bug introduced in 2.8.0 with time filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
wagga40 committed Jun 12, 2022
1 parent 621cd55 commit 869b771
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Binary file modified docs/Zircolite_manual.pdf
Binary file not shown.
5 changes: 3 additions & 2 deletions zircolite.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,8 @@ def flatten(x, name=""):
# Handle timestamp filters
if (
self.timeAfter != "1970-01-01T00:00:00"
and self.timeBefore != "9999-12-12T23:59:59"
) and self.timeField in JSONLine:
or self.timeBefore != "9999-12-12T23:59:59"
) and (self.timeField in JSONLine):
timestamp = time.strptime(
JSONLine[self.timeField].split(".")[0].replace("Z", ""),
"%Y-%m-%dT%H:%M:%S",
Expand Down Expand Up @@ -1631,6 +1631,7 @@ def avoidFiles(pathList, avoidFilesList):
timeBefore=eventsBefore,
limit=args.limit,
csvMode=args.csv,
timeField=args.timefield,
)

# If we are not working directly with the db
Expand Down
6 changes: 3 additions & 3 deletions zircolite_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def flatten(x, name=''):
except Exception as e:
self.logger.debug(f'JSON ERROR : {e}')
# Handle timestamp filters
if (self.timeAfter != "1970-01-01T00:00:00" and self.timeBefore != "9999-12-12T23:59:59") and self.timeField in JSONLine:
if (self.timeAfter != "1970-01-01T00:00:00" or self.timeBefore != "9999-12-12T23:59:59") and (self.timeField in JSONLine):
timestamp = time.strptime(JSONLine[self.timeField].split(".")[0].replace("Z",""), '%Y-%m-%dT%H:%M:%S')
if timestamp > self.timeAfter and timestamp < self.timeBefore:
JSONOutput.append(JSONLine)
Expand Down Expand Up @@ -1067,8 +1067,8 @@ def avoidFiles(pathList, avoidFilesList):
start_time = time.time()

# Initialize zirCore
zircoliteCore = zirCore(args.config, logger=consoleLogger, noOutput=args.nolog, timeAfter=eventsAfter, timeBefore=eventsBefore, limit=args.limit, csvMode=args.csv)

zircoliteCore = zirCore(args.config, logger=consoleLogger, noOutput=args.nolog, timeAfter=eventsAfter, timeBefore=eventsBefore, limit=args.limit, csvMode=args.csv, timeField=args.timefield)
# If we are not working directly with the db
if not args.dbonly:
# If we are working with json we change the file extension if it is not user-provided
Expand Down

0 comments on commit 869b771

Please sign in to comment.