help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Time zone trouble without time zones being involved


From: Yuri Khan
Subject: Re: Time zone trouble without time zones being involved
Date: Sun, 3 Apr 2016 12:43:40 +0600

On Sun, Apr 3, 2016 at 12:11 PM, Michael Heerdegen
<address@hidden> wrote:

> 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
> mode-line.

[…snipped…]

Your method looks sane to me, although the mention of TZ and mktime
regarding %s bother me a bit.

> 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.

Let’s determine which.

1. Mark the current UTC time, both as a human-readable string and as a
unixtime value (e.g. on GNU, “date --utc --rfc-3339=seconds” and “date
+%s”, respectively).
2. Make a commit.
3. Execute the same command, “git log --pretty=format:%ad --date=format:%s -n1”.
4. Evaluate (current-time) and convert the first two elements of the
resulting 4-element list to unixtime.
5. Check that the three unixtime values from steps 1, 3 and 4 are
reasonably close.
6. By the way, which OS are you on?



reply via email to

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