]> git.eshelyaron.com Git - emacs.git/commitdiff
Add optional FORMAT argument to 'emacs-init-time'
authorGabriel do Nascimento Ribeiro <gabriel.nascimento@nubank.com.br>
Wed, 24 Mar 2021 09:34:22 +0000 (10:34 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 24 Mar 2021 09:34:22 +0000 (10:34 +0100)
* lisp/time.el (emacs-init-time): Add optional FORMAT argument
(bug#47306).

lisp/time.el

index 1403c4ac00a1af740b034b8a30796174c9242e8d..7e1d9180f604ae6d2e8ecf62b311bbb0467cc818 100644 (file)
@@ -614,13 +614,14 @@ point."
         str))))
 
 ;;;###autoload
-(defun emacs-init-time ()
-  "Return a string giving the duration of the Emacs initialization."
+(defun emacs-init-time (&optional format)
+  "Return a string giving the duration of the Emacs initialization.
+FORMAT is a string to format the result, using `format'. If nil,
+the default format \"%f seconds\" is used."
   (interactive)
-  (let ((str
-        (format "%s seconds"
-                (float-time
-                 (time-subtract after-init-time before-init-time)))))
+  (let ((str (format (or format "%f seconds")
+                     (float-time (time-subtract after-init-time
+                                                before-init-time)))))
     (if (called-interactively-p 'interactive)
         (message "%s" str)
       str)))