Skip to content

Commit

Permalink
Merge pull request #99 from aviate-labs/98-remove-milliseconds-from-n…
Browse files Browse the repository at this point in the history
…ode_status_report

remove miliseconds from isoformatted datetime string
  • Loading branch information
mourginakis authored Oct 25, 2023
2 parents 6ff0fbd + f0f8f61 commit 243cda1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions node_monitor/node_monitor_helpers/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
# Forgive me Lord Guido, for I have broken PEP8.
Principal = str

def datetime_iso8601() -> str:
"""Returns the current time in ISO 8601 format, excluding milliseconds.
Example: 2021-05-01T00:00:00.
"""
return datetime.utcnow().isoformat(timespec='seconds')


def detailnode(node: ic_api.Node, label: str) -> str:
"""Returns:
Expand Down Expand Up @@ -73,7 +79,7 @@ def _make_subject() -> str:
f"{formatted_nodes_down}\n"
f"\n"
f"Node Monitor by Aviate Labs\n"
f"Report Generated: {datetime.utcnow().isoformat()} UTC\n"
f"Report Generated: {datetime_iso8601()} UTC\n"
f"Help us serve you better! Provide your feedback!\n")
return (subject, message)

Expand Down Expand Up @@ -124,6 +130,6 @@ def _render_frac(numerator: int, denominator: int) -> str:
f"\n"
f"Thanks for reviewing today's report. We'll be back tomorrow!\n"
f"Node Monitor by Aviate Labs.\n"
f"Report generated: {datetime.utcnow().isoformat()} UTC\n"
f"Report generated: {datetime_iso8601()} UTC\n"
f"Help us serve you better! Provide your feedback!\n")
return (subject, message)

0 comments on commit 243cda1

Please sign in to comment.