nasa / fprime-tools

F´ Python tooling and helpers.
https://github.com/nasa/fprime
Apache License 2.0
21 stars 39 forks source link

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

Closed Ahmad-Bamba closed 8 months ago

Ahmad-Bamba commented 8 months ago
Related Issue(s) 2375
Has Unit Tests (y/n) n
Documentation Included (y/n) n

Change Description

This change makes the TimeType.to_readable function use datetime.isoformat to convert the datetime object to a human readable format. In doing so, fprime-gds outputs channel.log entries with microsecond precision.

Rationale

The fundamental philosophy that must be applied to the ground system is that any conversion (time, DN->EU, units, etc.) should never decrease the resolution of the source data.

Testing/Review Recommendations

I tested the changes locally by first following the fprime hello world tutorial. Then I installed the local version of fprime-tools, and ran the example project with fprime-gds. This produced the following output that I've attached below showing no more accuracy loss in channel.log:

image

Compared with before this change:

image

Future Work

This seems like too a small change to make a unit test for, but I could think of a good way to design one if requested.

Ahmad-Bamba commented 8 months ago

Feel free to let me know if there is anything else that can be done to improve this

thomas-bc commented 8 months ago

@Ahmad-Bamba could you please also push the timespec="microseconds" change?

Ahmad-Bamba commented 8 months ago

Ah, I neglected to actually git add that file. My bad

Ahmad-Bamba commented 8 months ago

Should be good. Sorry about that!

thomas-bc commented 8 months ago

@LeStarch would you put a second set of eyes on this ?