Commit 9d6e9c84 authored by Li-Yun Chang's avatar Li-Yun Chang Committed by Kyle Meyer

magit-blame--format-time-string: Correct timezone handling

Because the time variable is an Unix time which is not related to time zone,
we don't have to update time according to time zone.

To deal with the different behavior of `format-time-string`

In emacs version > 25 :

If time-format contains the time zone symbol ( %z or %Z ),
use tz-in-second to format the time in committer time zone or author time zone.

If time-format doesn't contain the time zone symbol ( %z or %Z ),
assign tz-in-second to nil to format the time in local time zone.

In emacs version < 25 :

Just format the time string in local time zone
parent 66d9558f
......@@ -673,12 +673,14 @@ modes is toggled, then this mode also gets toggled automatically.
(face-attribute 'magit-blame-heading :background nil t))))
(defun magit-blame--format-time-string (time tz)
(setq time (string-to-number time))
(setq tz (string-to-number tz))
(or (magit-blame--style-get 'time-format)
(seconds-to-time (+ time (* (/ tz 100) 60 60) (* (% tz 100) 60)))))
(let* ((time-format (or (magit-blame--style-get 'time-format)
(tz-in-second (and (not (version< emacs-version "25"))
(string-match "%z" time-format)
(car (last (parse-time-string tz))))))
(format-time-string time-format
(seconds-to-time (string-to-number time))
(defun magit-blame--remove-overlays (&optional beg end)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment