From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#24716: 24.3; time-subtract result is one hour off Date: Thu, 20 Oct 2016 04:56:31 +0900 Message-ID: <87insom7tc.fsf@gmail.com> References: <20161017093904.GA29914@rosita.dfn-cert.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1476907060 1054 195.159.176.226 (19 Oct 2016 19:57:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Oct 2016 19:57:40 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 24716@debbugs.gnu.org, tino.calancha@gmail.com To: Friedrich Delgado Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 19 21:57:36 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwwzC-0005Cl-5v for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Oct 2016 21:57:14 +0200 Original-Received: from localhost ([::1]:50959 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwwzE-0003OS-EJ for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Oct 2016 15:57:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwwz4-0003Mu-RR for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:57:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwwz0-0000Uh-VX for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:57:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33891) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwwz0-0000UJ-Rp for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bwwz0-0007xz-DZ for bug-gnu-emacs@gnu.org; Wed, 19 Oct 2016 15:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Oct 2016 19:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24716 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24716-submit@debbugs.gnu.org id=B24716.147690701130604 (code B ref 24716); Wed, 19 Oct 2016 19:57:02 +0000 Original-Received: (at 24716) by debbugs.gnu.org; 19 Oct 2016 19:56:51 +0000 Original-Received: from localhost ([127.0.0.1]:40081 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwwyo-0007xY-IH for submit@debbugs.gnu.org; Wed, 19 Oct 2016 15:56:50 -0400 Original-Received: from mail-pf0-f178.google.com ([209.85.192.178]:33861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwwym-0007xJ-Mz for 24716@debbugs.gnu.org; Wed, 19 Oct 2016 15:56:49 -0400 Original-Received: by mail-pf0-f178.google.com with SMTP id r16so21297378pfg.1 for <24716@debbugs.gnu.org>; Wed, 19 Oct 2016 12:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=6bCVm/XibUETKtU8h3hgfuRPLQoZOGqzge/96nSuzw0=; b=lFWHEHH4Itjg0vODdzwTP1DBrcKz0hW0Zinsm1Rep8PBr8WZApttx7krzAph6vZ9F1 VlFXGUNJUbihEpjPLC54T0iursFzb1HkbizXy5fZr/15Tc/9dEO/onwfqtPWCwasleLx d3lBSG4A42Pcp6YRu6DE/2WX83ft8Bh3d7n/xaSyqk9r9IW2dGpi7g0EVaJbgMl3tumM R+s0I1sY5wthsQUvZh93Bx17uDOYmMvDcfHy8RJVbnlyaUv6CPEef+4hGFxp3iue5cx5 B6oxT5MLv4NlVmsH4yzYsCnIgnf6V3paaN0nS2rC0J0rHYInBawlwfeHZzmqG06JJLJl yBuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=6bCVm/XibUETKtU8h3hgfuRPLQoZOGqzge/96nSuzw0=; b=i/XkqO3CrgA3+rm7T8yVqqO1kpLkRtSFlgrpk06+ju+FgfOf9ooaekCRoULy269JZ7 qN0f6nx597Uvk4705oH0uYwQOe1supDLOIrfHL3hv+Ey9RMd/vedC1+APMYY5x6q7UP9 EO6FaNpKvUT5nWovuknOjXZzjpVq5ryT7W0OvNLUDkg+9Bi+7SH8/ctQkGp5uTSoG68R 8gvB7XGBGYMfXy6jJ29fQEUg2zaEAywxMFAz77NwbQh9Fe8LvRodO3eL8+RtRSUksiMd wWEzWXN7kQMSAqyqEfCPqd7jQy+gJfVkIFu+hRuCPOa+7soIFq64cTMtGctSg9gVN+8+ vweg== X-Gm-Message-State: AA6/9RmAN8OpkPJCs95i06HXM3a0wpG0C4VgyeSsiHsc0Mg2e0mPWIg5aReA9FFBxHES+w== X-Received: by 10.98.204.145 with SMTP id j17mr14177867pfk.83.1476907001862; Wed, 19 Oct 2016 12:56:41 -0700 (PDT) Original-Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id s85sm65815046pfi.17.2016.10.19.12.56.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Oct 2016 12:56:41 -0700 (PDT) In-Reply-To: <20161017093904.GA29914@rosita.dfn-cert.de> (Friedrich Delgado's message of "Mon, 17 Oct 2016 11:39:04 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:124692 Archived-At: Friedrich Delgado writes: Thank you for your report. I don't see nothing wrong. See below. > In emacs 24.3, I found that time-subtract returns a time difference > that is one hour to large. The same appears to be valid in 25.1. > > Evaluate the following: > > (decode-time (time-subtract (encode-time 0 10 18 10 10 2016 nil 3600) (encode-time 0 40 8 10 10 2016 nil 3600))) > > (decode-time (time-add (encode-time 0 40 8 10 10 2016 nil 3600) (time-subtract (encode-time 0 10 18 10 10 2016 nil 3600) (encode-time 0 40 8 10 10 2016 nil 3600)))) > > Results are: > (0 30 10 1 1 1970 4 nil 3600) > > for the first expression and > > (0 10 19 10 10 2016 1 t 7200) Both results are correct. > I'd expect a list starting with (0 30 9 ...) for the first expression The list would start (0 30 9 ...) if the time zone correspond to Greenwich meridian, then you would get the equivalent value: (0 30 9 1 1 1970 4 nil 0). > (because the duration from 8:40 in the morning to 18:10 in the evening > is 9 hours and 30 minutes, NOT 10 hours and 30 minutes) For time zone 3600, the origin of the time is: (0 0 1 1 1 1970 4 nil 3600). > and the second > list to start with 0 10 18 (so we arrive back at the later time if we > add the difference to the sooner time). Indeed you have arrived back to the sooner time: it starts (0 10 19 ... 7200) instead of (0 10 18 ... 3600) just because it is expressed in your time zone, i.e., +02:00, instead of +01:00, but it's the same absolute time. > chipping on #emacs tells me he gets a functionally equivalent result > on a more recent emacs version: > > chipping > TauPan: what is your result for the time-subtract version? I get (0 0 17 1 1 1970 4 nil 27000) on emacs 25.1.1 > > Since (format-time-string "%H:%M" (encode-time 0 0 17 1 1 1970 4 nil > 27000)) is "10:30" they're basically the same (wrong) result. The value from 25.1.1 (0 0 17 1 1 1970 4 nil 27000) is also correct: 27000 s = 7.5 h, 3600 s = 1 h Then, to translate (0 30 10 1 1 1970 4 nil 3600) to 27000 time zone we need to add 7.5 - 1 = 6.5 h 10:30 + 6.5h --> 17:00 Try to pass t as third argument to display the universal time: (format-time-string "%H:%M %z" (encode-time 0 0 17 1 1 1970 4 nil 27000) t) => "09:30 +0000"