File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -58,9 +58,25 @@ defmodule Calendar do
58
58
@ typedoc """
59
59
Microseconds with stored precision.
60
60
61
- The precision represents the number of digits that must be used when
61
+ The ` precision` represents the number of digits that must be used when
62
62
representing the microseconds to external format. If the precision is `0`,
63
- it means microseconds must be skipped.
63
+ it means microseconds must be skipped. If the precision is `6`, it means
64
+ that `value` represents exactly the number of microseconds to be used.
65
+
66
+ The formula to calculate microseconds from this type is:
67
+
68
+ microseconds = value * Integer.pow(10, 6 - precision)
69
+
70
+ ## Examples
71
+
72
+ * `{0, 0}` means no microseconds.
73
+ * `{1, 6}` means 1µs (`value` is `1` and the precision specifies that six digits
74
+ must be used).
75
+ * `{93, 3}` means 93ms (`value` is `93` and the precision specifies that three digits
76
+ must be used).
77
+ * `{12, 2}` means 120ms (`value` is `12` and the precision specifies that two digits
78
+ must be used).
79
+
64
80
"""
65
81
@ type microsecond :: { value :: non_neg_integer , precision :: non_neg_integer }
66
82
You can’t perform that action at this time.
0 commit comments