solve 'a while'
@@ -161,9 +161,14 @@ st.sidebar.markdown(
def get_most_recent_file_and_print(linac_id, filepaths): # pylint: redefined-outer-name
- most_recent = os.path.getmtime(max(filepaths, key=os.path.getmtime))
+ most_recent = datetime.fromtimestamp(
+ os.path.getmtime(max(filepaths, key=os.path.getmtime))
+ )
now = datetime.now()
+ if most_recent > now:
+ most_recent = now
+
human_readable = timeago.format(most_recent, now)
st.sidebar.markdown(f"{linac_id}: `{human_readable}`")
