hs-hourglass icon indicating copy to clipboard operation
hs-hourglass copied to clipboard

Fix incorrect parsing and printing micro- and nanoseconds

Open gltronred opened this issue 9 years ago • 4 comments

Fixes #23

Should I change something in this PR? Please tell me, because I'm not very familiar with pull requests and GitHub

gltronred avatar Feb 18 '16 21:02 gltronred

IIRC, printing the nanoseconds is only about printing the nanoseconds part below the microseconds. I appreciate that one might expect the other behavior of printing everything to the nanosecond precisions.

Also just notice that the documentation disagree with the code, so definitely bad.

parsing and printing code is expecting to get/set things in mask of 3 digits, whereas documentation says nanoseconds is 0 to 9999999999, microseconds is 0 to 999999, ...

vincenthz avatar Feb 27 '16 11:02 vincenthz

your PR is really good btw, adding tests is definitely the right thing to do. In the light on my comment, would you like to undo the change to the parsing/printing and make your test works ?

BTW, to print or parse sub seconds, you should use the Format_Precision n (9 for ns, 6 for us, 3 for ms), Format_{Milli,Micro,Nano}Seconds are used for parsing or printing such format 23s 100ms 200us

vincenthz avatar Feb 27 '16 11:02 vincenthz

OK, I will change parsing/printing and documentation about Format_{Micro,Nano}Seconds.

To clarify, is it true that [Format_Precision 9] should work the same way as [Format_MilliSeconds, Format_MicroSeconds, Format_NanoSeconds]?

gltronred avatar Feb 27 '16 11:02 gltronred

Thanks you !

about the question, yes. potentially have also the same properties with 6=Ms+Us and 3=Ms too.

vincenthz avatar Feb 27 '16 15:02 vincenthz

archiving repository

vincenthz avatar Sep 20 '23 06:09 vincenthz