mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 17:47:10 -06:00
This avoids a pernicious behavior where EVR timestamps lie about their
sub-second values. I have this test program:
#include <stdio.h>
#include <inttypes.h>
void main(void)
{
printf("%02d:%02d:%02d.%03" PRIu32 "\n", 1,2,3, 12);
printf("%02d:%02d:%02d.%03" PRIu32 "\n", 1,2,3, 123);
printf("%02d:%02d:%02d.%03" PRIu32 "\n", 1,2,3, 1234);
printf("%02d:%02d:%02d.%03" PRIu32 "\n", 1,2,3, 12356);
printf("%02d:%02d:%02d.%03" PRIu32 "\n", 1,2,3, 123456);
}
It produces this output:
01:02:03.012
01:02:03.123
01:02:03.1234
01:02:03.12356
01:02:03.123456
so prior to this patch, if we were 1 hour, 2 minutes, 3 seconds, 123
microseconds past midnight, this was printed as "01:02:03.123" instead of
"01:02:03.000123". Any reasonable human looking at "01:02:03.123" would see a
value of "123000" microseconds.
Co-authored-by: Dima Kogan <Dmitriy.Kogan@jpl.nasa.gov>