From e6522f2c3a404eac91307c675244eee7378eee3e Mon Sep 17 00:00:00 2001 From: M Starch Date: Thu, 19 Dec 2024 13:31:03 -0800 Subject: [PATCH] Fixes nasa/fprime#3086. Default to insertion order for chrono hist (#184) * Fixes nasa/fprime#3086. Default to insertion order for chrono hist Chronological history needs to default to insertion order when the timestamps of the items are identical. This is fixed by changing the < to <= when comparing timestamps for "older" items. * Fix comment --- src/fprime_gds/common/history/chrono.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fprime_gds/common/history/chrono.py b/src/fprime_gds/common/history/chrono.py index 75b15456..d3c523af 100644 --- a/src/fprime_gds/common/history/chrono.py +++ b/src/fprime_gds/common/history/chrono.py @@ -160,7 +160,9 @@ def __insert_chrono(data_object, ordered): the index that the item was inserted at (int) """ for i, item in reversed(list(enumerate(ordered))): - if item.get_time() < data_object.get_time(): + # Note: for events with the exact same time, this should default to the order received from downlink + # and as such the data item should be treated as newer because it was received later. + if item.get_time() <= data_object.get_time(): ordered.insert(i + 1, data_object) return i # If the data object is the earliest in the list or the list was empty