Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BF: tools/dtime to handle log line having non-increment timestamp
Apparently can happen, likely due to multithreading and different threads doing their own timestamping. Interestingly Python seems to not handle negative time delta "intuitively": (Pdb) p t datetime.datetime(2024, 5, 14, 19, 39, 12, 800000) (Pdb) p prevt datetime.datetime(2024, 5, 14, 19, 39, 12, 801000) (Pdb) p t - prevt datetime.timedelta(days=-1, seconds=86399, microseconds=999000) *(Pdb) p prevt -t datetime.timedelta(microseconds=1000) but since python 2.7 there is "total_seconds" which is behaving as desired and anyways we need those, so we can just use and thus operate correctly also whenever crossing some days boundary (hopefully never).
- Loading branch information