你们最长的`(emacs-uptime)'是多久

从前不爱折腾的时候最长大概一周左右。现在周末折腾的时候必搞崩一次。 整个系统最长的$(uptime)好像一百十天出头。

1 个赞

20 小时,主要是刚学会怎么记录 uptime。

  ;; https://emacsredux.com/blog/2014/12/23/uptime/
  (defvar my/emacs-uptime-log
    ;; (locate-user-emacs-file "uptime.log")
    (expand-file-name "assets/uptime.org" user-emacs-directory)
    "Log file for `my/log-emacs-uptime'.")
  (defun my/log-emacs-uptime ()
    "Write emacs uptime to `my/emacs-uptime-log'. Use with `kill-emacs-hook'."
    (with-temp-buffer
      (insert
       "|"
       (format-time-string "%FT%T%z" before-init-time)
       " | "
       (format-time-string "%FT%T%z" (current-time))
       " | "
       (emacs-uptime)
       " |"
       "\n")
      (append-to-file nil nil my/emacs-uptime-log)))
1 个赞

11 days, 23 hours, 52 minutes, 32 seconds

有个现成的包:GitHub - davep/uptimes.el: Uptime tracking system for Emacs.

emacs 自带啊 emacs-uptime

emacs-uptime is an autoloaded interactive byte-compiled Lisp function in ‘time.el’.

(emacs-uptime &optional FORMAT HERE)

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”. If the optional argument HERE is non-nil, insert string at point.

Probably introduced at or before Emacs version 23.1.

不喜欢干啥都用三方包,简短的功能我都直接写进init里。

emacs-uptime, emacs-init-time,这些都是自带命令啊

楼主提到的 emacs-uptime 命令显示当前 Emacs 运行时间,二楼的用来记录每次 Emacs 运行的时间,这两个作用不一样。

忽然想起一个犄角旮旯的服务器:

108 days, 20 hours, 51 minutes, 43 seconds

1 个赞

不错,加油跑满一年!