diff lisp/time.el @ 91862:af26df6df4a9

(emacs-uptime): Move here from time-date.el.
author Glenn Morris <rgm@gnu.org>
date Sat, 16 Feb 2008 03:29:43 +0000
parents 107ccd98fa12
children c4522ed32e3a
line wrap: on
line diff
--- a/lisp/time.el	Sat Feb 16 03:27:10 2008 +0000
+++ b/lisp/time.el	Sat Feb 16 03:29:43 2008 +0000
@@ -548,6 +548,20 @@
           (when (equal (symbol-name (aref elt 5)) "display-time-world-timer")
             (cancel-timer elt)))))))
 
+
+;;;###autoload
+(defun emacs-uptime ()
+  "Return a string giving the uptime of this instance of Emacs."
+  (interactive)
+  (let ((str
+         (format-seconds "%Y, %D, %H, %M, %S"
+                         (time-to-seconds
+                          (time-subtract (current-time) emacs-startup-time))
+                         t)))
+    (if (interactive-p)
+        (message "%s" str)
+      str)))
+
 (provide 'time)
 
 ;;; arch-tag: b9c1623f-b5cb-48e4-b650-482a4d23c5a6