Skip to content

detector extracts timestamps from human readable formats#71

Merged
ipmach merged 7 commits intodevelopmentfrom
fix/timestamp_bug
Mar 10, 2026
Merged

detector extracts timestamps from human readable formats#71
ipmach merged 7 commits intodevelopmentfrom
fix/timestamp_bug

Conversation

@thorinaboenke
Copy link

@thorinaboenke thorinaboenke commented Mar 6, 2026

Problem: #70
format_time() in detector.py assumed the Time is Unix timestamp, optionally with colon-separated suffix. It handled this by splitting on : and taking the first segment before casting to float: split(":")[0]
This breaks most other time formats containing a colon
12121.12:20 (testdata in test_core_detector.py) is not a valid timeformat at all
What generated this time log? Could this be some custom logging ( like processID.time) ?

Changes:

  • 12121.12:20 not a valid timestamp, removed the :20 from the test data
  • format_time() now uses the already existing _extract_timestamp() from TimeFormatHandler helper.
    --> this also now leads to if nothing is parsed, it returns silently 0 instead of error
  • added a test file test_extract_timestamp.py
  • added two more common formats to the TimeFormathandler

Note that probably not all possible timeformats are covered with this
Instead of hardcoded list, could consider dateutil (or similar), introduces python-dateutil dependency
int(dateutil_parser.parse(time).timestamp()) and might also not handle all possible formats correctly

@thorinaboenke thorinaboenke marked this pull request as draft March 6, 2026 16:38
@thorinaboenke thorinaboenke marked this pull request as ready for review March 9, 2026 12:36
@thorinaboenke thorinaboenke marked this pull request as draft March 9, 2026 14:11
@thorinaboenke thorinaboenke marked this pull request as ready for review March 9, 2026 14:40
Copy link
Contributor

@ipmach ipmach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@ipmach ipmach merged commit 0c6c062 into development Mar 10, 2026
1 check passed
@ipmach ipmach deleted the fix/timestamp_bug branch March 10, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants