all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: The longest Emacs uptime
Date: Sat, 11 Jul 2009 13:22:45 +0200	[thread overview]
Message-ID: <87k52fjwfu.fsf@galatea.local> (raw)
In-Reply-To: mailman.2266.1247291238.2239.help-gnu-emacs@gnu.org

Eddie Hillenbrand <edalytical@gmail.com> writes:

> How does one check their Emacs uptime?
>
> On Jul 10, 2009, at 10:10 AM, Leo wrote:
>
>> My Emacs uptime has reached 30 days, 3 hours, 27 minutes, 44 seconds.
>> This is the longest since I started using Emacs in 2005.

I've got this in my ~/.emacs:


(defun .EMACS (fctl &rest args)
  (let ((text (apply (function format) (concat ".EMACS: " fctl) args)))
    (with-current-buffer (get-buffer-create " .EMACS temporary buffer")
      (erase-buffer)
      (insert text "\n")
      (append-to-file (point-min) (point-max) "/tmp/messages.txt"))
    (message text)))


(defvar *emacs-start-time*   (current-time) "For (emacs-uptime)")

(.EMACS "emacs-uptime")
(defun emacs-uptime ()
  "Gives Emacs' uptime, based on global var `*emacs-start-time*'."
  (interactive)
  (let* ((st *emacs-start-time*)
         (cur (current-time))
         (hi-diff (- (car cur) (car st)))
         (tot-sec (+ (ash hi-diff 16) (- (cadr cur) (cadr st))))
         (days (/ tot-sec (* 60 60 24)))
         (hrs  (/ (- tot-sec (* days 60 60 24)) (* 60 60)))
         (mins (/ (- tot-sec (* days 60 60 24) (* hrs 60 60)) 60))
         (secs (/ (- tot-sec (* days 60 60 24) (* hrs 60 60) (* mins 60)) 1)))
    (.EMACS "Up %dd %dh %dm %ds (%s), %d buffers, %d files"
             days hrs mins secs
             (format-time-string "%a %Y-%m-%d %T" st)
             (length (buffer-list))
             (count t (buffer-list)
                    :test-not
                    (lambda (ignore buf)
                      (null (cdr (assoc 'buffer-file-truename
                                        (buffer-local-variables buf)))))))))
(defalias 'uptime 'emacs-uptime)

-- 
__Pascal Bourguignon__


  parent reply	other threads:[~2009-07-11 11:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-10 17:10 The longest Emacs uptime Leo
2009-07-10 17:18 ` Eddie Hillenbrand
2009-07-10 17:57 ` Sven Bretfeld
2009-07-10 18:07   ` Drew Adams
2009-07-10 20:21   ` Tassilo Horn
2009-07-10 21:01     ` Sven Bretfeld
     [not found]   ` <mailman.2243.1247249286.2239.help-gnu-emacs@gnu.org>
2009-07-10 22:43     ` magicus
2009-07-11  0:56       ` Pascal J. Bourguignon
2009-07-11  6:44         ` Richard Riley
2009-07-11 17:02         ` magicus
2009-07-11  9:48       ` Leo
     [not found]       ` <mailman.2273.1247305746.2239.help-gnu-emacs@gnu.org>
2009-07-14  8:25         ` Anul
2009-07-14  8:52           ` Leo
     [not found] ` <mailman.2266.1247291238.2239.help-gnu-emacs@gnu.org>
2009-07-11  6:53   ` Anselm Helbig
2009-07-11 11:22   ` Pascal J. Bourguignon [this message]
2009-07-13 18:01     ` Thien-Thi Nguyen
     [not found]     ` <mailman.2438.1247508445.2239.help-gnu-emacs@gnu.org>
2009-07-13 18:21       ` Pascal J. Bourguignon
2009-07-12  4:29 ` Byung-Hee HWANG
2009-07-12 11:22   ` Leo
2009-07-12 11:46     ` Byung-Hee HWANG
     [not found]     ` <mailman.2345.1247399189.2239.help-gnu-emacs@gnu.org>
2009-07-12 13:18       ` henry atting
2009-07-12 16:19         ` Leo
     [not found] <mailman.2236.1247245836.2239.help-gnu-emacs@gnu.org>
2009-07-11  0:54 ` Pascal J. Bourguignon
2009-07-11  9:50   ` Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k52fjwfu.fsf@galatea.local \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.