Skip to content

Commit 78fcf9d

Browse files
aduh95arp242
authored andcommitted
Clarify sub-millisecond precision is allowed
"Millisecond precision is required" could be interpreted as a requirement for input to be valid TOML. This commit adds examples of valid TOML time values that uses tens of second to remove the ambiguity.
1 parent 49aa41d commit 78fcf9d

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

toml.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ To unambiguously represent a specific instant in time, you may use an
563563
```toml
564564
odt1 = 1979-05-27T07:32:00Z
565565
odt2 = 1979-05-27T00:32:00-07:00
566-
odt3 = 1979-05-27T00:32:00.999999-07:00
566+
odt3 = 1979-05-27T00:32:00.5-07:00
567+
odt4 = 1979-05-27T00:32:00.999999-07:00
567568
```
568569

569570
For the sake of readability, you may replace the T delimiter between date and
@@ -581,10 +582,9 @@ odt5 = 1979-05-27 07:32Z
581582
odt6 = 1979-05-27 07:32-07:00
582583
```
583584

584-
Millisecond precision is required. Further precision of fractional seconds is
585-
implementation-specific. If the value contains greater precision than the
586-
implementation can support, the additional precision must be truncated, not
587-
rounded.
585+
Implementations are required to support at least millisecond precision.
586+
Additional digits of precision may be specified, but if they exceed the
587+
supported precision then the extra digits must be truncated, not rounded.
588588

589589
## Local Date-Time
590590

@@ -596,7 +596,8 @@ implementation-specific.
596596

597597
```toml
598598
ldt1 = 1979-05-27T07:32:00
599-
ldt2 = 1979-05-27T00:32:00.999999
599+
ldt2 = 1979-05-27T07:32:00.5
600+
ldt3 = 1979-05-27T00:32:00.999999
600601
```
601602

602603
Seconds may be omitted, in which case `:00` will be assumed.
@@ -610,6 +611,10 @@ implementation-specific. If the value contains greater precision than the
610611
implementation can support, the additional precision must be truncated, not
611612
rounded.
612613

614+
Implementations are required to support at least millisecond precision.
615+
Additional digits of precision may be specified, but if they exceed the
616+
supported precision then the extra digits must be truncated, not rounded.
617+
613618
## Local Date
614619

615620
If you include only the date portion of an
@@ -629,7 +634,8 @@ or timezone.
629634

630635
```toml
631636
lt1 = 07:32:00
632-
lt2 = 00:32:00.999999
637+
lt2 = 00:32:00.5
638+
lt3 = 00:32:00.999999
633639
```
634640

635641
Seconds may be omitted, in which case `:00` will be assumed.
@@ -643,6 +649,10 @@ implementation-specific. If the value contains greater precision than the
643649
implementation can support, the additional precision must be truncated, not
644650
rounded.
645651

652+
Implementations are required to support at least millisecond precision.
653+
Additional digits of precision may be specified, but if they exceed the
654+
supported precision then the extra digits must be truncated, not rounded.
655+
646656
## Array
647657

648658
Arrays are ordered values surrounded by square brackets. Whitespace is ignored.

0 commit comments

Comments
 (0)