diff --git a/README.md b/README.md index 2178800..c7bb949 100644 --- a/README.md +++ b/README.md @@ -22,21 +22,21 @@ W3C [Date and Time Formats](https://www.w3.org/TR/NOTE-datetime) in Java. ## Performance -Your mileage may vary. I've done my best to make sure these tests are as accurate as possible, but please do your own evaluation. -* The second resolution test-string is: `2017-12-21T12:20:45Z` -* The nanosecond-resolution test-string is: `2017-12-21T12:20:45.987654321Z` +TL;DR: 30-100x faster than Java JDK classes. ### Parsing -Performance of parsing +Performance of parsing ### Formatting -Performance of formatting +Performance of formatting + +The details and tests are available in a separate repository, [date-time-wars](https://github.com/ethlo/date-time-wars). ### Raw parsing If you do not need to have the full verification of `java.time.OffsetDateTime`, you can use the raw, parsed data through `com.ethlo.time.DateTime` that incurs less overhead. -Here it becomes even more visible how the parser scales with the length of the string that is parsed. +Here it becomes even clearer how the parser scales with the length of the string that is parsed. Performance of raw parsing ### Environment diff --git a/pom.xml b/pom.xml index 01c0e20..d320530 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ limitations under the License. com.ethlo.time bundle itu - 1.7.7 + 1.7.8-SNAPSHOT Internet Time Utility Very fast date-time parser and formatter - RFC 3339 (ISO 8601 profile) and W3C format diff --git a/src/test/java/com/ethlo/time/LenientParseTests.java b/src/test/java/com/ethlo/time/LenientParseTests.java index 2f8b6e5..eab5bf0 100644 --- a/src/test/java/com/ethlo/time/LenientParseTests.java +++ b/src/test/java/com/ethlo/time/LenientParseTests.java @@ -46,6 +46,14 @@ public void testParseTimestamp() assertThat(a.toInstant()).isEqualTo(OffsetDateTime.parse(s).toInstant()); } + @Test + public void testParseYear() + { + final String s = "2018"; + final DateTime a = ITU.parseLenient(s); + assertThat(a.toInstant()).isEqualTo(OffsetDateTime.parse(s + "-01-01T00:00:00Z").toInstant()); + } + @Test public void testParseYearMonth() { @@ -67,6 +75,6 @@ public void testParseYearMonthHourMinutes() { final String s = "2018-11-27T12:30"; final DateTime a = ITU.parseLenient(s); - assertThat(a.toInstant()).isEqualTo(OffsetDateTime.parse(s + ":00Z").toInstant()); + assertThat(a.toInstant()).isEqualTo(OffsetDateTime.parse(s + "Z").toInstant()); } }