(when (equal (symbol-name (aref elt 5)) "display-time-world-timer")
(cancel-timer elt)))))))
-\f
;;;###autoload
-(defun emacs-uptime ()
- "Return a string giving the uptime of this instance of Emacs."
+(defun emacs-uptime (&optional format)
+ "Return a string giving the uptime of this instance of Emacs.
+FORMAT is a string to format the result, using `format-seconds'.
+For example, the Unix uptime command format is \"%D, %z%2h:%.2m\"."
(interactive)
(let ((str
- (format-seconds "%Y, %D, %H, %M, %S"
+ (format-seconds (or format "%Y, %D, %H, %M, %z%S")
(time-to-seconds
- (time-subtract (current-time) emacs-startup-time))
- t)))
+ (time-subtract (current-time) before-init-time)))))
+ (if (interactive-p)
+ (message "%s" str)
+ str)))
+
+;;;###autoload
+(defun emacs-init-time ()
+ "Return a string giving the duration of the Emacs initialization."
+ (interactive)
+ (let ((str
+ (format "%.1f seconds"
+ (time-to-seconds
+ (time-subtract after-init-time before-init-time)))))
(if (interactive-p)
(message "%s" str)
str)))
(provide 'time)
-;;; arch-tag: b9c1623f-b5cb-48e4-b650-482a4d23c5a6
+;; arch-tag: b9c1623f-b5cb-48e4-b650-482a4d23c5a6
;;; time.el ends here