Get the difference between DateTime instances with clj-time

I am trying to calculate the difference between two instances of DateTime using clj-time . I looked through the documentation and found clj-time.core/minus and clj-time.core/minus- , but both require an instance of org.joda.time.ReadablePeriod , not one of DateTime . I would prefer to use cli-time, but if there is no solution, what would be the cleanest method for computing delta using Joda Time?

Thanks for the help.

+5
source share
1 answer

I use this snippet very often in my daily work:

 (ns project.namespace1 (:require [clj-time [core :as t]] ) (let [start-time (t/now)] ... do lots of work ... (t/in-millis (t/interval start-time (t/now)))) 
+7
source

Source: https://habr.com/ru/post/1212746/


All Articles