-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35844 from Ladicek/fix-duration-format-description
Improve description of the duration format in configuration documentation
- Loading branch information
Showing
4 changed files
with
51 additions
and
25 deletions.
There are no files selected for viewing
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
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
17 changes: 11 additions & 6 deletions
17
docs/src/main/asciidoc/_includes/duration-format-note.adoc
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
[NOTE] | ||
==== | ||
The format for durations uses the standard `java.time.Duration` format. | ||
You can learn more about it in the link:https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence-[Duration#parse() javadoc]. | ||
To write duration values, use the standard `java.time.Duration` format. | ||
See the link:https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/Duration.html#parse(java.lang.CharSequence)[Duration#parse() javadoc] for more information. | ||
You can also provide duration values starting with a number. | ||
In this case, if the value consists only of a number, the converter treats the value as seconds. | ||
Otherwise, `PT` for seconds, minute and hours or `P` for days are implicitly prepended to the value to obtain a standard `java.time.Duration` format. | ||
Milliseconds are also supported by implicitly using `Duration.ofMillis()` | ||
You can also use a simplified format, starting with a number: | ||
* If the value is only a number, it represents time in seconds. | ||
* If the value is a number followed by `ms`, it represents time in milliseconds. | ||
In other cases, the simplified format is translated to the `java.time.Duration` format for parsing: | ||
* If the value is a number followed by `h`, `m`, or `s`, it is prefixed with `PT`. | ||
* If the value is a number followed by `d`, it is prefixed with `P`. | ||
==== |
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