We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 790e6a7 commit d2f2ca9Copy full SHA for d2f2ca9
src/ert/gui/model/snapshot.py
@@ -69,6 +69,8 @@
69
state.COLOR_NOT_ACTIVE: QColor(*state.COLOR_NOT_ACTIVE),
70
}
71
72
+_warn_once = True
73
+
74
75
def _estimate_duration(
76
start_time: datetime, end_time: datetime | None = None
@@ -429,6 +431,16 @@ def _fm_step_data(
429
431
)
430
432
# There is no method for truncating microseconds, so we remove them
433
delta -= timedelta(microseconds=delta.microseconds)
434
+ if delta < timedelta():
435
+ global _warn_once # noqa: PLW0603
436
+ if _warn_once:
437
+ _warn_once = False
438
+ logger.warning(
439
+ "Negative duration in snapshot encountered. "
440
+ f"start_time={start_time} end_time={node.data.get(ids.END_TIME)} "
441
+ f"delta={delta}"
442
+ )
443
+ delta = timedelta()
444
return str(delta)
445
446
return node.data.get(data_name)
0 commit comments