From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Time zone trouble without time zones being involved Date: Sun, 15 May 2016 03:51:43 +0600 Message-ID: References: <87shz3cjbo.fsf@web.de> <87a8kxtris.fsf@web.de> <87k2k1h1ka.fsf@web.de> <87a8js8oa8.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1463262745 3854 80.91.229.3 (14 May 2016 21:52:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 May 2016 21:52:25 +0000 (UTC) Cc: Emacs mailing list To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 14 23:52:25 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b1hTz-0002BE-Cr for geh-help-gnu-emacs@m.gmane.org; Sat, 14 May 2016 23:52:23 +0200 Original-Received: from localhost ([::1]:38974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1hTy-0001qx-JT for geh-help-gnu-emacs@m.gmane.org; Sat, 14 May 2016 17:52:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1hTn-0001mP-8D for help-gnu-emacs@gnu.org; Sat, 14 May 2016 17:52:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1hTh-0005C7-Eq for help-gnu-emacs@gnu.org; Sat, 14 May 2016 17:52:10 -0400 Original-Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]:33144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1hTh-0005Bs-6g for help-gnu-emacs@gnu.org; Sat, 14 May 2016 17:52:05 -0400 Original-Received: by mail-lb0-x229.google.com with SMTP id jj5so38188119lbc.0 for ; Sat, 14 May 2016 14:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=fTnM4Lc8z9jIZPXKqMNjlXculcblXyyEGuwd54R78A4=; b=CD2YFUAD//QUfeL6gA1i2iYH5GYywEqIrdoS7Bc8aJCZcJ0a8LYb+Vplipk+97drXA odGOarRlU5hUDdZUpi1+eDNeXG077sAOSByJnDBDRiuZsjdzAYHpTo69szVjttpVmL9X uzZLgDPw9o715o22mWqvB3HamyeEX0Bli57xelO7L0cAP+CJXsMlVeFJtVaO+SjW2E2n Zt6hG/sZ8Z3W0tzOTOwiRVOmutaiTSrTrlVYpG323lTYV1QFu0aJRtSiA9pEzMJNVaM3 9P0izwIYg7K8HwrO/89CKJx3Wfx0ZzwDZ0Dt7KS/IJQ+caTEGq6mAMipNWuYr2HQYiMU obIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=fTnM4Lc8z9jIZPXKqMNjlXculcblXyyEGuwd54R78A4=; b=AJ+4qnzKJr01j0lPUOo9wSOBbXHl23OoNy4tH3FJoLOtno297DfbZq4Hk286j5oZWa TexrP0YUaYNxYBT5rK2PHGRgrITVo5OxkYrIbnJqDbfuFqmSaOWOzW+9BsSLepbvJCFo sTfPdr6H/T4lO6b5QdHs8j0A9hxuQ4N9m0396866gLkGFkmTSMhv2QS/thv1TDFbVihw VCKg8c4k2jZhZitClh0MrXr4dwg5t3ZdfDELI/xwfgBg4yWliPdji+DBKDqEFWrmr/wb +01HBaJLsxz1hGSmY++RbfOficFfCMkwohLE05pirb97bNDGmRQp07NSS2lQK04+WMKp shbg== X-Gm-Message-State: AOPr4FXN0kaHFUDLru/PJawXiasf7+YdHpR12qYt5MxS6n7IYNZjmv5lgHsM6RcgdC5REfLalbY+nUxFgAV6iw== X-Received: by 10.112.147.229 with SMTP id tn5mr9176941lbb.120.1463262723526; Sat, 14 May 2016 14:52:03 -0700 (PDT) Original-Received: by 10.112.172.197 with HTTP; Sat, 14 May 2016 14:51:43 -0700 (PDT) In-Reply-To: <87a8js8oa8.fsf@web.de> X-Google-Sender-Auth: -g70s_tJvT5S4XYdQ7BGijH3XjA X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c04::229 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:109953 Archived-At: On Sun, May 15, 2016 at 12:53 AM, Michael Heerdegen wrote: > Here are the results. It is 20:44 here now after I run the tests > (Central European Daylight savings time, the time zone of Berlin). So, UTC+1 in winter, UTC+2 in summer. >> 1. Mark the current UTC time, both as a human-readable string and as a >> unixtime value (e.g. on GNU, =E2=80=9Cdate --utc --rfc-3339=3Dseconds=E2= =80=9D and =E2=80=9Cdate >> +%s=E2=80=9D, respectively). > > date --utc --rfc-3339=3Dseconds =3D> 2016-05-14 18:38:17+00:00 > date +%s =3D> 1463251129 The unixtime works out to 2016-05-14 18:38:49+00:00, consistent with the UTC time. Also consistent with your wall clock considering the UTC+2 offset. >> 2. Make a commit. 3. Execute the same command, =E2=80=9Cgit log >> --pretty=3Dformat:%ad --date=3Dformat:%s -n1=E2=80=9D. > > 1463254759 1463254759 - 1463251129 =3D 3630 seconds, or 1 hour 30 seconds. Does =E2=80=9Cgit cat-file commit HEAD=E2=80=9D show the same number in the= =E2=80=9Cauthor=E2=80=9D line? >> 4. Evaluate (current-time) and convert the first two elements of the >> resulting 4-element list to unixtime. > > (let ((time (current-time))) (+ (* 65536 (car time)) (cadr time))) > =3D=3D> 1463251305 176 seconds from step 1. > Looks like git is 1 hour wrong...? Yes. Here=E2=80=99s a repeatable recipe. You can report it as a Git bug. 0. Versions $ git --version git version 2.8.2 $ dpkg -l tzdata | tail -1 ii tzdata 2016d-0ubuntu0.16.04 all time zone and daylight-saving time data 1. Initialize an empty Git repository: $ git init test $ cd test 2. Make a commit, using the Europe/Berlin time zone: $ TZ=3DEurope/Berlin git commit -m 'test' --allow-empty 3. Examine the timestamp recorded in the commit object: $ git cat-file -p HEAD | grep author author Yuri Khan 1463260938 +0200 4. Check that it corresponds to the current time: $ date +%s 1463260977 5. Try to get the commit date in the unixtime format: $ TZ=3DEurope/Berlin git log --pretty=3Dformat:%ad --date=3Dformat:%s -= 1 Expected result: 1463260938 (same as recorded in the commit object). Observed result: 1463264538 (3600s =3D one hour ahead). For lulz, use another time zone: $ TZ=3DAsia/Novosibirsk git log --pretty=3Dformat:%ad --date=3Dformat:%= s -1 Expected result: 1463260938 (unixtime is always UTC and should not depend on TZ). Observed result: 1463246538 (-14400s =3D 4 hours behind). Not even specifying the UTC time zone helps: $ TZ=3DUTC git log --pretty=3Dformat:%ad --date=3Dformat:%s -1 Expected result: still 1463260938. Observed result: 1463268138 (7200s =3D 2 hours ahead).