OEM Time stamp precision

Hello,

I’m generating an OEM, and everything is working well, except I’m getting quite a few decimal places on my timestamps: 2024-02-15T02:24:44.99999998400879

I don’t think I know my time that well :slight_smile:

Is it possible to limit the output to millisecond precision?

Here’s the relevant bit of code:

writer = EphemerisOemWriter(
            WriterBuilder().buildOemWriter(),
            None, 
            oem_meta,
            FileFormat.KVN,
            "OEM",
            0.0,  
            0, 
        )

        oem_str = StringBuilder()
        writer.write(oem_str, orekit_file)

In any case, millisecond precision is clearly not sufficient. A LEO satellite flying at 7km/s travels 7m in one millisecond. When dealing with navigation or oceanography, this is order of magnitudes above acceptable limits.

The point is that we intend to work around the fact that saving data into text files and retrieving it later is prone to round-trip errors, i.e. we loose accuracy. If the data is used for example to compute finite differences, these round-trip errors can be huge, I have been bitten a few time by such errors. If the data is used for polynomial interpolation, truncation errors also introduce weird effects. Another bad side effect of truncation error is validation between different implementations. These errors can be avoided, there are no reasons why we should write output data to an accuracy that is arbitrarily set to the physical models accuracy: the file output error should be order of magnitudes below the physical model accuracy, so the limiting factor remains the model, not the file format.

In order to achieve this goal, we use the Ryū algorithm that generates the shortest decimal representation of a floating point number that maintains round-trip safety. We intentionally did not allow users settings for accuracy, because many people would choose too loose accuracy, not thinking about finite differences or polynomial interpolation later on on users side.