Fwd: Re: [PATCH 21.5] Fix signs in time zone string.

Adrian Aichner <[email protected]> Tue, 30 Sep 2014 17:45:27 +0200
Newsgroups gmane.emacs.xemacs.patches
Message-ID <[email protected]>
(wasn't in the moderator queue either)


-------- Forwarded Message --------
Subject: 	Re: [PATCH 21.5] Fix signs in time zone string.
Date: 	Tue, 30 Sep 2014 12:38:25 +0200
From: 	Adrian Aichner <[email protected]>
To: 	[email protected]



Hi Marcus, this patch looks wrong to me.

How could XEmacs and GNU Emacs both be wrong until now?

http://git.savannah.gnu.org/cgit/emacs.git/tree/src/editfns.c#n1937
suggests that they are not including a + character for positive offsets,
which surprised me.

But zone offsets > 0 do not include the - sign, which is the same logic
XEmacs uses before your patch.

Also, why are you removing the REST argument in passing without mention?

Adrian

On 30.09.2014 08:13, Marcus Crestani wrote:
> PATCH 21.5
>
> Currently, Fencode_time calculates wrong dates in respect to local
> timezones.  The problem is caused by switched signs in the code that
> builds the time zone string, the attached patch fixes this.
>
> I'll push in two days if nobody objects.
>
>
> diff --git a/src/ChangeLog b/src/ChangeLog
> --- a/src/ChangeLog
> +++ b/src/ChangeLog
> @@ -1,3 +1,9 @@
> +2014-09-30  Marcus Crestani  <[email protected]>
> +
> +	* editfns.c (Fencode_time): Switch signs when calculating the time
> +	zone string. (The offset indicates the value one must add to the
> +	local time to arrive at UTC.)
> +
>   2014-09-23  Jerry James  <[email protected]>
>
>   	* floatfns.c (round_two_bignum_1): Fix memory leak.
> diff --git a/src/editfns.c b/src/editfns.c
> --- a/src/editfns.c
> +++ b/src/editfns.c
> @@ -1155,7 +1155,7 @@
>   Year numbers less than 100 are treated just like other year numbers.
>   If you want them to stand for years in this century, you must do that yourself.
>
> -arguments: (SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE &rest REST)
> +arguments: (SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE)
>   */
>          (int nargs, Lisp_Object *args))
>   {
> @@ -1192,7 +1192,7 @@
>   	  int abszone = abs (XFIXNUM (zone));
>   	  /* #### I have no idea what this conforms to,
>   	     but the compiler has stopped whining. */
> -	  sprintf (tzbuf, "XXX%s%d:%02d:%02d", (XFIXNUM (zone) < 0) ? "-" : "+",
> +	  sprintf (tzbuf, "XXX%s%d:%02d:%02d", (XFIXNUM (zone) < 0) ? "+" : "-",
>   		   abszone / (60*60), (abszone/60) % 60, abszone % 60);
>   	  tzstring = tzbuf;
>   	}
>

_______________________________________________
XEmacs-Patches mailing list
[email protected]
http://lists.xemacs.org/mailman/listinfo/xemacs-patches