Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CR 2375: TimeType.to_readable should display microsecond precision. #197

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
isfile
isinstance
isnumeric
isoformat
Isr
issubclass
iterdir
Expand Down Expand Up @@ -246,6 +247,7 @@
testimpl
textwrap
timebase
timespec
toctree
todo
toolchain
Expand Down Expand Up @@ -282,5 +284,5 @@
www
wxgui
xml
version-check

Check warning on line 287 in .github/actions/spelling/expect.txt

View workflow job for this annotation

GitHub Actions / Spell checking

ignoring entry because it contains non alpha characters (non-alpha-in-dictionary)
0x48piraj
5 changes: 4 additions & 1 deletion src/fprime/common/models/serialize/time_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ def to_readable(self, time_zone=None):

# If we could convert to a valid datetime, use that, otherwise, format
if dt:
return dt.strftime("%Y-%m-%d %H:%M:%S%z")
# datetime.isoformat() returns time string with microsecond
# precision.
# This line can be changed for other precisions or needs.
return dt.isoformat(timespec="microseconds")
return "%s: %d.%06ds, context=%d" % (
TimeBase(self.__timeBase.val).name,
self.__secs.val,
Expand Down
1 change: 1 addition & 0 deletions src/fprime/common/models/serialize/type_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@author: reder
Replaced type base class with decorators
"""

import abc

from .type_exceptions import AbstractMethodException
Expand Down
Loading