hs-hourglass
hs-hourglass copied to clipboard
Fix incorrect parsing and printing micro- and nanoseconds
Fixes #23
Should I change something in this PR? Please tell me, because I'm not very familiar with pull requests and GitHub
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, ...
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
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]?
Thanks you !
about the question, yes. potentially have also the same properties with 6=Ms+Us and 3=Ms too.
archiving repository