                 (ycmd--with-all-ycmd-buffers (ycmd--report-status 'unparsed))))
              (t
               ;; timeout after specified period
-              (when (< (/ ycmd-startup-timeout 1000) (- (float-time) start-time))
+              (when (< ycmd-startup-timeout (- (float-time) start-time))
                 (ycmd--with-all-ycmd-buffers (ycmd--report-status 'errored))
                 (when (ycmd-running?) (ycmd-close))
                 (error "ERROR: Ycmd server timeout"))))))))))


  (ycmd--start-keepalive-timer))

(defun ycmd-close (&optional time-out-secs)
  "Shutdown any running ycmd server.

Wait TIME-OUT-SECS seconds after `interrupt-process' call for the
ycmd server to end before killing the process with
`delete-process'.

This does nothing if no server is running."
  (interactive)

  (unwind-protect
      (when (ycmd-running?)
        (condition-case nil
            (progn
              (interrupt-process ycmd--server-process)
              (when time-out-secs
                (sit-for time-out-secs)
                (delete-process ycmd--server-process)))
          (error nil)))
    (ycmd--global-teardown))

  (ycmd--kill-timer ycmd--keepalive-timer))

(defun ycmd-running? ()
  "Return t if a ycmd server is already running."
  (and (get-process ycmd--server-process) t))

(defun ycmd--keepalive ()
  "Sends an unspecified message to the server.

  "Start a new server using HMAC-SECRET as its hmac secret."
  (let ((proc-buff (get-buffer-create ycmd--server-buffer-name)))
    (with-current-buffer proc-buff
      (buffer-disable-undo proc-buff)
      (erase-buffer)

      (let* ((options-file (ycmd--create-options-file hmac-secret))
