Skip to content

Commit

Permalink
Add stardate/now in Clojure
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Oei committed Oct 1, 2014
1 parent 5fb2f1a commit 0880c83
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Clojure/stardate/project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject stardate "2.0.0"
(defproject stardate "2.1.0"
:description "A library that converts to/from fractional years. Requires Java 8+."
:url "http://github.com/chrisoei/stardate"
:scm {
Expand Down
4 changes: 4 additions & 0 deletions Clojure/stardate/src/stardate.clj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
)
)

(defn now []
(ofInstant (Instant/now))
)

(defn ofZonedDateTime
([#^ZonedDateTime zdt]
(let [
Expand Down
4 changes: 4 additions & 0 deletions Clojure/stardate/test/stardate_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
)
)

(deftest now-test
(testing "now"
(approx (stardate/now) (stardate/ofZonedDateTime (ZonedDateTime/now)))))

(deftest toInstant-test
(testing "toInstant 2014.747978420491791"
(is (= epoch-milli-fixture
Expand Down

0 comments on commit 0880c83

Please sign in to comment.