          http/get)]
 
       (let [
-          playlist (grab-and-process m3u8)
-          elapsed (- (after) before)]
+         playlist (grab-and-process m3u8)
+         elapsed (- (after) before)
+         seconds (* elapsed 1e-9)]
 
-         (println "successfully fetched the playlist in" (* elapsed 1e-9) "seconds")
+         (println "successfully fetched the playlist in" seconds "seconds")
          playlist)))
 
 (defn get-segment

      after #(System/nanoTime)
      filename (clojure.string/replace (clojure.string/trim-newline seg-url) #".*/" "")]

      (with-open [
         whandle (clojure.java.io/output-stream filename)]

         (let [
            elapsed (- (after) before)
            millisec (long (* elapsed 1e-6))]

            (.write whandle (:body (http/get seg-url {:as :byte-array})))
            (println "successfully fetched" filename "in" millisec "ms (pausing for the same amount of time)")
            (Thread/sleep millisec)))))

(defn -main
   [url]

      [post-process (comp
         (partial dorun)
         (partial map get-segment)
         (partial take 9) ; for debugging purposes only - remove later
         get-playlist)]

      (post-process url)))
