summaryrefslogtreecommitdiff
path: root/lisp/time.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-02-16 03:31:19 +0000
committerGlenn Morris <rgm@gnu.org>2008-02-16 03:31:19 +0000
commit04e5613961922a9bd83f1255781b04b7a85dd8a9 (patch)
tree26449f1b69c5d90b7bfd88f052c850d4a8811d03 /lisp/time.el
parent99d8d5404b352255a311ece28eb41e9ddc4e37c7 (diff)
(emacs-uptime): Add optional `format' argument. Doc fix. Use `%z'
rather than removed `nonzero' argument of format-seconds.
Diffstat (limited to 'lisp/time.el')
-rw-r--r--lisp/time.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/time.el b/lisp/time.el
index c9ca2059b7b..dc4e500cddc 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -550,14 +550,15 @@ To turn off the world time display, go to that window and type `q'."
;;;###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) emacs-startup-time)))))
(if (interactive-p)
(message "%s" str)
str)))