 
 (defn interruptible-sleep [time-ms]
   (let [sleepy (CountDownLatch. 1)]
-    (state-assoc! :sleepy sleepy :next-wake-time (+ (clock-ms) time-ms))
+    (state-assoc! :sleepy sleepy :next-wake-time (+ (jvm-time-ms) time-ms))
     (.await sleepy time-ms TimeUnit/MILLISECONDS)))
 
 (defn acq-sleep [interval-ms]

      :stop false
      :running true
      :finished false
      :last-wake-time (clock-ms)
      :last-stage-positions (into {} [[default-z-drive z]
                                [default-xy-stage xy]])
      :last-position nil     
      :reference-z z
      :start-time (clock-ms)
      :init-auto-shutter (core getAutoShutter)
      :init-exposure (core getExposure)
      :default-z-drive default-z-drive

(defn store-new-z-reference []
  (let [z-drive (@state :default-z-drive)]
    (when (and (or (not (core isContinuousFocusEnabled))
                   (core isContinuousFocusDrive z-drive))
               (not (z-in-msp z-drive)))
      (state-assoc! :reference-z (get-z-stage-position z-drive)))))

;; startup and shutdown
