From: Paul Eggert Date: Mon, 6 Dec 2021 06:52:26 +0000 (-0800) Subject: Simplify by using format-time-string X-Git-Tag: emacs-29.0.90~3612^2^2~3 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dbef2145c78a8b6cd913d677e50a0b7df0b1b831;p=emacs.git Simplify by using format-time-string * lisp/mail/sendmail.el (mail-do-fcc): * lisp/net/tramp.el (tramp-debug-message): Prefer format-time-string to doing time formatting by hand. --- diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index d0aff093dfe..d1e8a2f3c69 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -1391,8 +1391,7 @@ just append to the file, in Babyl format if necessary." (unless (markerp header-end) (error "Value of `header-end' must be a marker")) (let (fcc-list - (mailbuf (current-buffer)) - (time (current-time))) + (mailbuf (current-buffer))) (save-excursion (goto-char (point-min)) (let ((case-fold-search t)) @@ -1408,14 +1407,11 @@ just append to the file, in Babyl format if necessary." (with-temp-buffer ;; This initial newline is not written out if we create a new ;; file (see below). - (insert "\nFrom " (user-login-name) " " (current-time-string time) "\n") - ;; Insert the time zone before the year. - (forward-char -1) - (forward-word-strictly -1) (require 'mail-utils) - (insert (mail-rfc822-time-zone time) " ") - (goto-char (point-max)) - (insert "Date: " (message-make-date) "\n") + (insert "\nFrom " (user-login-name) " " + (let ((system-time-locale "C")) + (format-time-string "%a %b %e %T %z %Y")) + "\nDate: " (message-make-date) "\n") (insert-buffer-substring mailbuf) ;; Make sure messages are separated. (goto-char (point-max)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index f43c1d84b87..552788b4615 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2014,9 +2014,7 @@ ARGUMENTS to actually emit the message (if applicable)." (unless (bolp) (insert "\n")) ;; Timestamp. - (let ((now (current-time))) - (insert (format-time-string "%T." now)) - (insert (format "%06d " (nth 2 now)))) + (insert (format-time-string "%T.%6N ")) ;; Calling Tramp function. We suppress compat and trace ;; functions from being displayed. (let ((btn 1) btf fn)