[Top][All Lists]

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

Time zone trouble without time zones being involved

From: Michael Heerdegen
Subject: Time zone trouble without time zones being involved
Date: Sun, 03 Apr 2016 08:11:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)


I'm using git to make a backup of the file I'm working with after every
save.  I want to display the age of the last backup made in the

To be able to control the time display format from Elisp, I decided to
ask git-log for the time since "the Epoch":

#+begin_src emacs-lisp
 (helm-backup-exec-git-command "log" ref "--pretty=format:%ad"
                               "--date=format:%s" "-n1"

(where `helm-backup-exec-git-command' just calls "git" with the
specified args).

"%ad" means "author date", and "%s" means, according to "man strftime",
"The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
(TZ) (Calculated from mktime(tm).)"

After saving a file, this value is saved to the local variable

In the mode-line, I show this:

#+begin_src emacs-lisp
       (require 'timeclock)
       (propertize (concat " "
                             (time-subtract (current-time)
                   'face 'mode-line-shadow))))

The problem: since we have Daylight saving time, this always shows one
hour less than the expected value (directly after saving it shows
-0:59h).  This makes no sense to me, since I only work with "seconds
since Epoch" absolute time values that I thought would not depend on the
local time zone.  So either git or Emacs seems to make an error.

Do I miss something?  How can I prevent that wrong behavior?



reply via email to

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