Skip to content

Commit 87e038b

Browse files
author
Vadim Platonov
committed
implementation details
1 parent 2ab2bb3 commit 87e038b

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/dm3/clojure.java-time.png?branch=master)](https://travis-ci.org/dm3/clojure.java-time)
44

5-
An idiomatic Clojure wrapper for Java 8 Date-Time API.
5+
A Clojure wrapper for Java 8 Date-Time API.
66

77
Main goals:
88

@@ -216,6 +216,17 @@ Parse a date:
216216
=> #object[java.time.LocalDate "2015-09-28"]
217217
```
218218

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+
219230
#### Conversions
220231

221232
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.
378389
(properties (local-date 2015 9 28))
379390
=> {:proleptic-month #java_time.temporal.TemporalFieldProperty{...}, ...}
380391
```
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

Comments
 (0)