Skip to content

Commit

Permalink
infer type
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchy64 committed Oct 13, 2017
1 parent e379633 commit 8c2f28a
Showing 1 changed file with 241 additions and 5 deletions.
246 changes: 241 additions & 5 deletions src/clj_time/core.clj
Expand Up @@ -96,6 +96,236 @@
LocalDateTime MutableDateTime DateTimeUtils]
[org.joda.time.base BaseDateTime]))

;; Automatically added requires by core.typed
(require '[clojure.core.typed :as t])
;; Start: Generated by clojure.core.typed - DO NOT EDIT
(declare)
(t/ann abuts? [Interval Interval :-> Boolean])
(t/ann ago [(t/U Years Days) :-> DateTime])
(t/ann available-ids [:-> java.util.Collections$UnmodifiableSortedSet])
(t/ann
date-midnight
(t/IFn [t/Int t/Int t/Int :-> DateMidnight] [t/Int :-> DateMidnight]))
(t/ann
date-time
(t/IFn
[t/Int t/Int t/Int :-> DateTime]
[t/Int t/Int t/Int t/Int t/Int t/Int t/Int :-> DateTime]
[t/Int t/Int t/Int t/Int t/Int t/Int t/Int t/Int :-> t/Any]
[t/Int t/Int t/Int t/Int t/Int t/Int :-> DateTime]
[t/Int t/Int t/Int t/Int t/Int :-> DateTime]
[t/Int t/Int t/Int t/Int :-> DateTime]
[t/Int t/Int :-> DateTime]
[t/Int :-> DateTime]))
(t/ann days (t/IFn [:-> PeriodType] [t/Int :-> Days]))
(t/ann days? [Days :-> Boolean])
(t/ann default-time-zone [:-> org.joda.time.tz.CachedDateTimeZone])
(t/ann deprecated AnyFunction)
(t/ann
do-at*
[(t/U DateTime DateMidnight)
[:-> (t/U DateTime LocalDate DateMidnight)]
:->
(t/U DateTime LocalDate DateMidnight)])
(t/ann
earliest
(t/IFn
[DateTime (t/U nil DateTime) :-> (t/U nil DateTime)]
[(t/Vec (t/U nil DateTime)) :-> (t/U nil DateTime)]))
(t/ann end [Interval :-> DateTime])
(t/ann epoch [:-> DateTime])
(t/ann extend [Interval Years :-> Interval])
(t/ann
first-day-of-the-month
(t/IFn
[t/Int t/Int :-> DateTime]
[(t/U DateTime LocalDate) :-> (t/U DateTime LocalDate)]))
(t/ann floor [DateTime [DateTime :-> t/Int] :-> t/Any])
(t/ann from-now [Minutes :-> DateTime])
(t/ann
from-time-zone
[DateTime
(t/U
org.joda.time.tz.FixedDateTimeZone
org.joda.time.tz.CachedDateTimeZone)
:->
DateTime])
(t/ann hours (t/IFn [:-> PeriodType] [t/Int :-> Hours]))
(t/ann hours? [Hours :-> Boolean])
(t/ann in-msecs AnyFunction)
(t/ann in-secs AnyFunction)
(t/ann interval [DateTime DateTime :-> Interval])
(t/ann
last-day-of-the-month
(t/IFn
[t/Int t/Int :-> DateTime]
[(t/U DateTime LocalDate) :-> (t/U DateTime LocalDate)]))
(t/ann
latest
(t/IFn
[DateTime (t/U nil DateTime) :-> DateTime]
[(t/Vec (t/U nil DateTime)) :-> DateTime]))
(t/ann local-date [t/Int t/Int t/Int :-> LocalDate])
(t/ann
local-date-time
(t/IFn
[t/Int :-> LocalDateTime]
[t/Int t/Int t/Int :-> LocalDateTime]
[t/Int t/Int t/Int t/Int t/Int :-> LocalDateTime]
[t/Int t/Int t/Int t/Int t/Int t/Int :-> LocalDateTime]
[t/Int t/Int t/Int t/Int :-> LocalDateTime]
[t/Int t/Int t/Int t/Int t/Int t/Int t/Int :-> LocalDateTime]))
(t/ann
local-time
(t/IFn
[t/Int t/Int t/Int :-> LocalTime]
[t/Int t/Int t/Int t/Int :-> LocalTime]
[t/Int :-> LocalTime]))
(t/ann
max-date
(t/IFn
[DateTime
DateTime
DateTime
DateTime
DateTime
DateTime
DateTime
:->
DateTime]
[DateTime :-> DateTime]))
(t/ann millis [t/Int :-> Period])
(t/ann
min-date
(t/IFn
[DateTime
DateTime
DateTime
DateTime
DateTime
DateTime
DateTime
:->
DateTime]
[DateTime :-> DateTime]))
(t/ann mins-ago [DateTime :-> t/Int])
(t/ann
minus
(t/IFn
[(t/U DateTime LocalDateTime)
Hours
Minutes
:->
(t/U DateTime LocalDateTime)]
[(t/U DateTime LocalDateTime)
(t/U Minutes Years Days Hours)
:->
(t/U DateTime LocalDateTime)]))
(t/ann minutes (t/IFn [t/Int :-> Minutes] [:-> PeriodType]))
(t/ann minutes? [Minutes :-> Boolean])
(t/ann months (t/IFn [:-> PeriodType] [t/Int :-> Months]))
(t/ann months? [Months :-> Boolean])
(t/ann now [:-> DateTime])
(t/ann nth-day-of-the-month [DateTime t/Int :-> DateTime])
(t/ann
number-of-days-in-the-month
(t/IFn [t/Int t/Int :-> t/Int] [DateTime :-> t/Int]))
(t/ann overlap [Interval (t/U nil Interval) :-> (t/U nil Interval)])
(t/ann
overlaps?
(t/IFn
[LocalDate LocalDate LocalDate LocalDate :-> Boolean]
[Interval Interval :-> Boolean]))
(t/ann
plus
(t/IFn
[(t/U DateTime LocalDateTime)
Years
Months
Days
Hours
Minutes
Seconds
Period
:->
(t/U DateTime LocalDateTime)]
[(t/U DateTime LocalDateTime)
Hours
Minutes
:->
(t/U DateTime LocalDateTime)]
[(t/U DateTime LocalDateTime)
(t/U Weeks Minutes Years Days Period Hours)
:->
(t/U DateTime LocalDateTime)]))
(t/ann seconds (t/IFn [:-> PeriodType] [t/Int :-> Seconds]))
(t/ann seconds? [Seconds :-> Boolean])
(t/ann secs AnyFunction)
(t/ann secs? AnyFunction)
(t/ann start [Interval :-> DateTime])
(t/ann time-now AnyFunction)
(t/ann
time-zone-for-id
[t/Str
:->
(t/U
org.joda.time.tz.CachedDateTimeZone
org.joda.time.UTCDateTimeZone)])
(t/ann
time-zone-for-offset
(t/IFn
[t/Int
t/Int
:->
(t/U
org.joda.time.tz.FixedDateTimeZone
org.joda.time.UTCDateTimeZone)]
[t/Int
:->
(t/U
org.joda.time.tz.FixedDateTimeZone
org.joda.time.UTCDateTimeZone)]))
(t/ann
to-time-zone
[DateTime
(t/U
org.joda.time.tz.FixedDateTimeZone
org.joda.time.tz.CachedDateTimeZone
org.joda.time.UTCDateTimeZone)
:->
DateTime])
(t/ann today [:-> LocalDate])
(t/ann
today-at
(t/IFn
[t/Int t/Int t/Int :-> DateTime]
[t/Int t/Int :-> DateTime]
[t/Int t/Int t/Int t/Int :-> DateTime]))
(t/ann
today-at-midnight
(t/IFn
[org.joda.time.tz.FixedDateTimeZone :-> DateMidnight]
[:-> DateMidnight]))
(t/ann utc org.joda.time.UTCDateTimeZone)
(t/ann weeks (t/IFn [:-> PeriodType] [t/Int :-> Weeks]))
(t/ann weeks? [Weeks :-> Boolean])
(t/ann with-time-at-start-of-day [DateTime :-> DateTime])
(t/ann
within?
(t/IFn
[(t/U DateTime LocalDate)
(t/U DateTime LocalDate)
(t/U DateTime LocalDate)
:->
Boolean]
[Interval DateTime :-> Boolean]))
(t/ann
year-month
(t/IFn [t/Int t/Int :-> YearMonth] [t/Int :-> YearMonth]))
(t/ann years (t/IFn [:-> PeriodType] [t/Int :-> Years]))
(t/ann years? [Years :-> Boolean])
(t/ann yesterday [:-> DateTime])
;; End: Generated by clojure.core.typed - DO NOT EDIT
(defn deprecated [message]
(println "DEPRECATION WARNING: " message))

Expand Down Expand Up @@ -582,16 +812,22 @@
([^ReadableInstant dt1 ^ReadableInstant dt2]
(if (pos? (compare dt1 dt2)) dt2 dt1))
([dts]
(reduce (fn [dt1 dt2]
(if (pos? (compare dt1 dt2)) dt2 dt1)) dts)))
(reduce (t/ann-form
(fn [dt1 dt2]
(if (pos? (compare dt1 dt2)) dt2 dt1))
[DateTime (t/U nil DateTime) :-> (t/U nil DateTime)])
dts)))

(defn latest
"Returns the latest of the supplied DateTimes"
([^ReadableInstant dt1 ^ReadableInstant dt2]
(if (neg? (compare dt1 dt2)) dt2 dt1))
([dts]
(reduce (fn [dt1 dt2]
(if (neg? (compare dt1 dt2)) dt2 dt1)) dts)))
(reduce (t/ann-form
(fn [dt1 dt2]
(if (neg? (compare dt1 dt2)) dt2 dt1))
[DateTime (t/U nil DateTime) :-> DateTime])
dts)))

(defn interval
"Returns an interval representing the span between the two given ReadableDateTimes.
Expand Down Expand Up @@ -775,4 +1011,4 @@
(map apply
(concat (take-while (partial not= dt-fn) dt-fns) [dt-fn])
(repeat [dt])))
tz))))
tz))))

0 comments on commit 8c2f28a

Please sign in to comment.