]> code.delx.au - gnu-emacs/blobdiff - lisp/time.el
(proced-mode): Redefine as just the major-mode.
[gnu-emacs] / lisp / time.el
index ef98c6a781906309b1aac240393d35bb32bdf11b..3db8e97a45e2cf6c68024fceb151ee7bb4efdf11 100644 (file)
@@ -1,7 +1,7 @@
 ;;; time.el --- display time, load and mail indicator in mode line of Emacs -*-coding: utf-8 -*-
 
 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1996, 2000, 2001, 2002,
-;;   2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 
@@ -548,7 +548,33 @@ To turn off the world time display, go to that window and type `q'."
           (when (equal (symbol-name (aref elt 5)) "display-time-world-timer")
             (cancel-timer elt)))))))
 
+;;;###autoload
+(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 (or format "%Y, %D, %H, %M, %z%S")
+                         (time-to-seconds
+                          (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