|
2 | 2 |
|
3 | 3 | [](https://travis-ci.org/dm3/clojure.java-time) |
4 | 4 |
|
5 | | -An idiomatic Clojure wrapper for Java 8 Date-Time API. |
| 5 | +A Clojure wrapper for Java 8 Date-Time API. |
6 | 6 |
|
7 | 7 | Main goals: |
8 | 8 |
|
@@ -216,6 +216,17 @@ Parse a date: |
216 | 216 | => #object[java.time.LocalDate "2015-09-28"] |
217 | 217 | ``` |
218 | 218 |
|
| 219 | +Zoned date-times and offset date-times/times always take the zone/offset as the |
| 220 | +last argument. Offsets can be specified as float values: |
| 221 | + |
| 222 | +```clj |
| 223 | +(j/offset-time +1.5) |
| 224 | +=> #<java.time.OffsetTime 10:16:08.000+01:30> |
| 225 | + |
| 226 | +(j/offset-time -1.5) |
| 227 | +=> #<java.time.OffsetTime 07:16:08.000-01:30> |
| 228 | +``` |
| 229 | + |
219 | 230 | #### Conversions |
220 | 231 |
|
221 | 232 | Time entities can be converted to other time entities if the target contains |
@@ -378,3 +389,17 @@ queries uniformly across all of the entity types. |
378 | 389 | (properties (local-date 2015 9 28)) |
379 | 390 | => {:proleptic-month #java_time.temporal.TemporalFieldProperty{...}, ...} |
380 | 391 | ``` |
| 392 | + |
| 393 | +## Implementation Details |
| 394 | + |
| 395 | +Most of the temporal entity constructors with arities 1 to 3 use the conversion |
| 396 | +graph underneath. This provides for a very flexible way of defining the |
| 397 | +conversions while avoiding huge conditional statements and multiple definitions |
| 398 | +of the identical conversion logic. However, the flexibility comes with a cost: |
| 399 | + |
| 400 | +1. The first call to a constructor will take around ~100ms as it will try to |
| 401 | + find a path in the conversion graph. Subsequent calls will reuse the path. |
| 402 | +2. It's not trivial to evaluate the impact of adding and removing conversions |
| 403 | + both on the performance and the conversion path chosen for certain arguments. |
| 404 | + |
| 405 | +Hopefully, the performance issue will be resolved in the future... |
0 commit comments