This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What about defining a constructor to control the precision?
Constructor will help if you manually create the encoder, but it won't be as easy to use when unmarshalling a configuration from a YAML file.
For your use-case, do you want to control the precision, or would you prefer to use int vs float?
Actually, I don't care about the precision, what I want is just how many milliseconds the operation costs. 30 or 30.05 are both ok for me, but 30.00005 smells bad. But as the test case shows, all the other encoder could show how nanoseconds it costs(1.0000005s 1.0000005 1000000500)，I don't know if something like 1.02 will bring some inconsistencies. But really, I think float with just two decimal places is better. When people choose ms encoder, nobody cares about the nanoseconds
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.