comparison lisp/time.el @ 91894:8172ec5d2dd0

(emacs-init-time): New function.
author Juri Linkov <juri@jurta.org>
date Sat, 16 Feb 2008 23:18:00 +0000
parents 927a69bb381a
children 37418cd19627
comparison
equal deleted inserted replaced
91893:1aaa6ac14ee4 91894:8172ec5d2dd0
546 (while list 546 (while list
547 (let ((elt (pop list))) 547 (let ((elt (pop list)))
548 (when (equal (symbol-name (aref elt 5)) "display-time-world-timer") 548 (when (equal (symbol-name (aref elt 5)) "display-time-world-timer")
549 (cancel-timer elt))))))) 549 (cancel-timer elt)))))))
550 550
551
552 ;;;###autoload 551 ;;;###autoload
553 (defun emacs-uptime (&optional format) 552 (defun emacs-uptime (&optional format)
554 "Return a string giving the uptime of this instance of Emacs. 553 "Return a string giving the uptime of this instance of Emacs.
555 FORMAT is a string to format the result, using `format-seconds'. 554 FORMAT is a string to format the result, using `format-seconds'.
556 For example, the Unix uptime command format is \"%D, %z%2h:%.2m\"." 555 For example, the Unix uptime command format is \"%D, %z%2h:%.2m\"."
561 (time-subtract (current-time) before-init-time))))) 560 (time-subtract (current-time) before-init-time)))))
562 (if (interactive-p) 561 (if (interactive-p)
563 (message "%s" str) 562 (message "%s" str)
564 str))) 563 str)))
565 564
565 ;;;###autoload
566 (defun emacs-init-time ()
567 "Return a string giving the duration of the Emacs initialization."
568 (interactive)
569 (let ((str
570 (format-seconds "%z%S"
571 (time-to-seconds
572 (time-subtract after-init-time before-init-time)))))
573 (if (interactive-p)
574 (message "%s" str)
575 str)))
576
566 (provide 'time) 577 (provide 'time)
567 578
568 ;;; arch-tag: b9c1623f-b5cb-48e4-b650-482a4d23c5a6 579 ;;; arch-tag: b9c1623f-b5cb-48e4-b650-482a4d23c5a6
569 ;;; time.el ends here 580 ;;; time.el ends here