Mercurial > emacs
changeset 91864:c4522ed32e3a
(emacs-uptime): Add optional `format' argument. Doc fix. Use `%z'
rather than removed `nonzero' argument of format-seconds.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 16 Feb 2008 03:30:57 +0000 |
parents | 5f14edcf524f |
children | 773399d06e32 |
files | lisp/time.el |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/time.el Sat Feb 16 03:30:28 2008 +0000 +++ b/lisp/time.el Sat Feb 16 03:30:57 2008 +0000 @@ -550,14 +550,15 @@ ;;;###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)))