emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master dbef214 10/13: Simplify by using format-time-string


From: Paul Eggert
Subject: master dbef214 10/13: Simplify by using format-time-string
Date: Mon, 6 Dec 2021 02:24:23 -0500 (EST)

branch: master
commit dbef2145c78a8b6cd913d677e50a0b7df0b1b831
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    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.
---
 lisp/mail/sendmail.el | 14 +++++---------
 lisp/net/tramp.el     |  4 +---
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index d0aff09..d1e8a2f 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 f43c1d8..552788b 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]