Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78578 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46524 invoked from network); 3 Nov 2014 15:11:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Nov 2014 15:11:56 -0000 Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.46 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.192.46 mail-qg0-f46.google.com Received: from [209.85.192.46] ([209.85.192.46:46362] helo=mail-qg0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 39/15-08476-B3B97545 for ; Mon, 03 Nov 2014 10:11:55 -0500 Received: by mail-qg0-f46.google.com with SMTP id i50so7865307qgf.33 for ; Mon, 03 Nov 2014 07:11:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=cYDJ6+Gac+Qwprj3ALYJyM8vndsUQeamMYozoTYDdII=; b=05uB+DjXo6JELcHpwQ1UvZOK+8ed0v7uDogXozzC1uji+f0/8IUODdTIFfmMFewrXT suTxYFVPqIlXmaMqW4NV8Cv3KlReY8KRy2phHcSDcmhO77ZhgqvWD0l7ba2JXA3bKr+A ehFl63TYlKjRcAyE2zTnnncdUxOm8nNGhy5pLtYIcMM7Y4Q0hITwu6yETsJ9BQxxenZ0 rI9PPjAXLAZ68YpyoSj6wwADdWu2qIarLgXvN4D/5Qr3D+lzqgF9eVvbydq3iPK9jG1U anE6xRHGqzS6jWhVQ6M/Fgdm9zAOW8E7w9hMnTms7fiz8D6cyr+ziYtDLnLn6o5bT34+ qRrg== MIME-Version: 1.0 X-Received: by 10.140.101.120 with SMTP id t111mr62431295qge.6.1415027512175; Mon, 03 Nov 2014 07:11:52 -0800 (PST) Sender: are.you.winning@gmail.com Received: by 10.140.239.194 with HTTP; Mon, 3 Nov 2014 07:11:52 -0800 (PST) In-Reply-To: <5452218C.7020303@beccati.com> References: <5452218C.7020303@beccati.com> Date: Mon, 3 Nov 2014 15:11:52 +0000 X-Google-Sender-Auth: JL6S8F1GLl87VcCX7eyHX0FMyyE Message-ID: To: Matteo Beccati Cc: Trevor Suarez , PHP internals Content-Type: multipart/alternative; boundary=001a11c15d7e366a2b0506f5c4e9 Subject: Re: [PHP-DEV] [PR] DateTime RFC7231 constant From: cw@daverandom.com (Chris Wright) --001a11c15d7e366a2b0506f5c4e9 Content-Type: text/plain; charset=UTF-8 On 30 October 2014 11:31, Matteo Beccati wrote: > Hi, > > On 30/10/2014 08:03, Trevor Suarez wrote: > > Good early morning (late night for me) internals! > > > > I would like to propose a small addition be made to the DateTime date > > format constant definitions. > > > > https://github.com/php/php-src/pull/882 > > Thanks for the PR. > > However, I'm afraid the comments on the PR code are correct. The output > is supposed to be UTC time, not just local time with "GMT" appended. > > This is true, and there isn't really a particularly good solution to this if implementing this as a constant. However, it should be possible to add a new format character for this (e.g. R) - the constant could be added as well in this scenario, with value of the new character. This would be a minor BC break. It's probably still worth considering for (5.)?7, since at the moment the only way to definitely (and sanely) get this right every time is via gmdate(), which may result in messy code when working with DateTime etc objects. Trevor, if you do want to look at implementing this for practice/improving your C skills etc, it's not a particularly difficult task, it's largely just a simpler version of the handling of "r", that does not consider the localtime flag or generate the offset digits. The relevant part of the source code is here: http://lxr.php.net/xref/PHP_5_6/ext/date/php_date.c#1189 The "R" format character is available and probably makes the most sense of the available possibilities, as the format approximately complements "r". Thanks, Chris --001a11c15d7e366a2b0506f5c4e9--