]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix faulty decoded-time adjustment in erc-stamp
authorF. Jason Park <jp@neverwas.me>
Sun, 10 Mar 2024 13:08:30 +0000 (06:08 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 11 Mar 2024 09:25:52 +0000 (10:25 +0100)
* lisp/erc/erc-stamp.el (erc-stamp--lr-date-on-pre-modify): Remove
disruptive assertion for now.
(erc-stamp--time-as-day): Attempt to fix date being rewound by a whole
day when daylight saving time is in effect.  Do this by forcing the
`dst' slot of the `decoded-time' object to -1 and the `zone' to nil.

(cherry picked from commit f3da3d1c68bef60ef28d67c6d8fa5d0cba8c9f08)

lisp/erc/erc-stamp.el

index a8190a2c94a009285b045efd74fc690226547533..44f92c5a7e2ce646fe87866bcd27919c13498425 100644 (file)
@@ -723,9 +723,6 @@ inserted is a date stamp."
                                          'hash-table))
                (erc-timestamp-last-inserted-left rendered)
                erc-timestamp-format erc-away-timestamp-format)
-          ;; FIXME delete once convinced adjustment correct.
-          (cl-assert (string= rendered
-                              (erc-stamp--format-date-stamp aligned)))
           (erc-add-timestamp))
         (setq erc-timestamp-last-inserted-left rendered)))))
 
@@ -833,7 +830,11 @@ left-sided stamps and date stamps inserted by this function."
          (decoded (decode-time current-time erc-stamp--tz)))
     (setf (decoded-time-second decoded) 0
           (decoded-time-minute decoded) 0
-          (decoded-time-hour decoded) 0)
+          (decoded-time-hour decoded) 0
+          (decoded-time-dst decoded) -1
+          (decoded-time-weekday decoded) nil
+          (decoded-time-zone decoded)
+          (and erc-stamp--tz (car (current-time-zone nil erc-stamp--tz))))
     (encode-time decoded))) ; may return an integer
 
 (defun erc-format-timestamp (time format)