added a comment - - edited
This patch implements instant literals of the form #@yyyy-mm-ddThh:mm:ss.fff+hh:mm using only classes available in the JRE.
clojure.instant provides instant-readers producing instances of three different JDK classes. These functions accept a string representing a timestamp See (doc clojure.instant/parse-timestamp) for details.
- read-instant-date (java.util.Date)
- read-instant-calendar (java.util.Calendar)
- read-instant-timestamp (java.sql.Timestamp)
By default *instant-reader* is bound to read-instant-date.
print-method and print-dup are provided for all three types.
Rough bits include:
I'm not yet certain about the exact public interface of clojure.instant. It's clear that read-instant-* need to be visible. It also seems likely that parse-timestamp and validated could usefully support alternate implementations for *instant-reader*.
fixup-offset and fixup-nanos are ugly warts necessitated by Java's pathetic built-in support for dates and times (possibly exacerbated by my own misunderstandings of the same).
Unit tests are very basic. For example, I'm not testing validated except in the good case where everything is valid.
See also https://github.com/bpsm/clojure/commit/753f991151847df53d624f7c09b7113cd2321793
I've made a few trivial fixes to doc strings, visible on my github branch. Those changes will be included when I re-roll the patch it to incorporate any feedback.
I have tested patch locally with no Joda, 1.6.2 Joda, and 2.0 Joda. All work as intended in simple invocations.
Seeking feedback on