     (.format format (.getTime one-hour-ago))))
     
 (def yyyymmdd (SimpleDateFormat. "yyyyMMdd"))
-
-(doto (Calendar/getInstance) (.add Calendar/HOUR -1))
 
 ;(defn result-file [bits mode]
 ;  (File. micromanager (str "/result" bits (name mode) ".txt")))

  (let [f (result-file bits mode)
        result-txt (slurp f)
        vs-error-text (visual-studio-error-text result-txt)
        outdated-dlls (old-dlls (File. micromanager
                                       (condp = bits
                                         32 "bin_Win32"
                                         64 "bin_x64")) 24)
        javac-errs (javac-errors result-txt)
        outdated-jars (old-jars (File. micromanager "Install_AllPlatforms") 24)
        installer-ok (exe-on-server? bits today-token)]
    (when-not (and (empty? vs-error-text) (empty? outdated-dlls)
                   (empty? javac-errs) (empty? outdated-jars)
                   installer-ok)

        pattern (re-pattern (str "MMSetup" bits "BIT_[^\\s]+?_" date-token ".exe"))]
    (re-find pattern txt)))

(defn device-vcproj-files []
  (let [device-adapter-dirs [(File. micromanager "/DeviceAdapters")
                         (File. micromanager "/SecretDeviceAdapters")]]
    (filter #(.. % getName (endsWith ".vcproj"))
            (mapcat file-seq device-adapter-dirs))))

(defn dll-name [file]
  (second (re-find #"mmgr_dal_(.*?).dll" (.getName file))))

(defn project-name [vcproj-file]
  (-> vcproj-file clojure.xml/parse :attrs :Name))

(defn bin-dir [bits]
  (File. micromanager
         (condp = bits
           32 "bin_Win32"
           64 "bin_x64")))

(defn missing-device-adapters [bits]
  (let [dll-names (map dll-name (device-adapter-dlls (bin-dir bits)))
        project-names (map project-name (device-vcproj-files))]
    (sort (clojure.set/difference (set project-names) (set dll-names)))))
     
(defn str-lines [sequence]
  (apply str (interpose "\n" sequence)))

