I noticed while working with this crate that timestamps were behaving strangely. Looking into it, it seems the scale of the components wasn't always right - nanoseconds being treated as milliseconds, for example.
Also the formatting of the timestamps in the output JSON didn't seem right - 2ms being displayed as .2 seconds rather than .002 seconds.
I'm not 100% clear on how milliseconds over a thousand should be handled in the seconds timestamp; I've opted to split 1234 milliseconds into 1 second (to be added to the epoch seconds left of the decimal point) and 234 milliseconds (to the right of the decimal point), since the overall "number" string is meant to represent seconds. This means that adding more than a second will always result in a larger number, rather than .234 becoming .1234, for example, which would be smaller.
I still wonder if this should be moved to normalize_seconds() instead? I'm no expert on leap seconds handling etc which is why I'm hesitant here. Pretty sure it's more correct than before, though!
I noticed while working with this crate that timestamps were behaving strangely. Looking into it, it seems the scale of the components wasn't always right - nanoseconds being treated as milliseconds, for example.
Also the formatting of the timestamps in the output JSON didn't seem right - 2ms being displayed as .2 seconds rather than .002 seconds.
I'm not 100% clear on how milliseconds over a thousand should be handled in the seconds timestamp; I've opted to split 1234 milliseconds into 1 second (to be added to the epoch seconds left of the decimal point) and 234 milliseconds (to the right of the decimal point), since the overall "number" string is meant to represent seconds. This means that adding more than a second will always result in a larger number, rather than .234 becoming .1234, for example, which would be smaller.
I still wonder if this should be moved to normalize_seconds() instead? I'm no expert on leap seconds handling etc which is why I'm hesitant here. Pretty sure it's more correct than before, though!
Hope this helps :)