Skip to content

Commit

Permalink
fixed without-past-times to work with joda date-times
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Severo authored and jarohen committed Aug 17, 2020
1 parent e3da39a commit 9a33f05
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGES.org
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
* Changes
** 0.3.3
Changes:
- The without-past-times didn't work with joda dates, even with chime.joda-date imported.

** 0.3.2
I left in some println debugging. Apologies.

Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject jarohen/chime "0.3.2"
(defproject jarohen/chime "0.3.3-SNAPSHOT"
:description "A really lightweight Clojure scheduler"

:url "https://github.com/jarohen/chime"
Expand Down
2 changes: 1 addition & 1 deletion src/chime/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@

([times now]
(->> times
(drop-while #(.isBefore ^Instant % (->instant now))))))
(drop-while #(.isBefore ^Instant (->instant %) now)))))
13 changes: 12 additions & 1 deletion test/chime_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
[chime :refer :all]
[clojure.core.async :as a :refer [<! go-loop]]
[clojure.test :refer :all]
[chime.core :as chime])
[chime.core :as chime]
[chime.joda-time]
[clj-time.core :as t]
[clj-time.periodic])
(:import (java.time Instant)
(java.time.temporal ChronoUnit)))

Expand Down Expand Up @@ -161,3 +164,11 @@
(reset! proof true))})
(while (not @proof))
(is @proof)))

(deftest backwards-compatibility-without-past-times-test
(let [times (-> (t/date-time 1990 1 1)
(t/from-time-zone (t/time-zone-for-offset -3))
(clj-time.periodic/periodic-seq (t/days 1))
(as-> x
(take 100 x)))]
(is (empty? (chime/without-past-times times)))))

0 comments on commit 9a33f05

Please sign in to comment.