Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68025 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74507 invoked from network); 1 Jul 2013 03:10:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2013 03:10:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:46613] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/91-63159-713F0D15 for ; Sun, 30 Jun 2013 23:10:16 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 136877000441; Mon, 1 Jul 2013 04:10:13 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id 6FzGj1Gek2yH; Mon, 1 Jul 2013 04:10:12 +0100 (WEST) Received: from nebm.ist.utl.pt (unknown [IPv6:2001:690:2100:4::58:1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 82C1A7000436; Mon, 1 Jul 2013 04:10:12 +0100 (WEST) Received: from localhost ([127.0.0.1] helo=nebm.ist.utl.pt) by nebm.ist.utl.pt with esmtp (Exim 4.72) (envelope-from ) id 1UtUVI-0006ci-F4; Mon, 01 Jul 2013 04:10:12 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 01 Jul 2013 05:10:12 +0200 To: Stas Malyshev Cc: PHP Internals Organization: =?UTF-8?Q?N=C3=BAcleo_de_Engenharia_Biom=C3=A9dica_do_Insti?= =?UTF-8?Q?tuto_Superior_T=C3=A9cnico?= In-Reply-To: <51D0E896.10300@sugarcrm.com> References: <51D0AA4C.9020805@sugarcrm.com> <2e3d0947cdbe7832ec27295eadad9b5d@nebm.ist.utl.pt> <51D0E896.10300@sugarcrm.com> Message-ID: X-Sender: glopes@nebm.ist.utl.pt User-Agent: RoundCube Webmail/0.8-rc Subject: Re: =?UTF-8?Q?IntlTimeZone=3A=3AgetOffset=3F?= From: glopes@nebm.ist.utl.pt (Gustavo Lopes) Em 2013-07-01 4:25, Stas Malyshev escreveu: > >> It can be a UTC timestamp (if $local is false), but note it's in >> milliseconds since the epoch, not seconds. The documentation is >> here: > > It looks like it's the only place in PHP where we represent date this > way. Given that this function has no docs at all, it's even more > confusing. This is not correct. Some functions in IntlCalendar also use this direct representation of UDate, see e.g. http://pt2.php.net/manual/en/intlcalendar.getnow.php http://pt2.php.net/manual/en/intlcalendar.gettime.php > Can't we make it work in line with all other PHP functions > that deal with dates? I understand ICU does it this way, but should > we > really make the API mimic ICU so closely? How would one use such > function? The other functions outside ICU don't work with anything smaller than the second, so they're not directly comparable. It is true, however, that IntlDateFormatter and MessageFormatter work with (possibly fractional) seconds. As far as I know, there's not any strictly technical reason to prefer working milliseconds rather than seconds short of saving some arithmetic operations before passing the values to ICU -- I don't think the rounding error introduced by dividing by 1000 is relevant for the sort of dates one is likely to work with. I take no position on whether changing the API to take fractional seconds is a good idea, but I should point out that there are policy reasons that would advise against such a change -- namely, it's in a stable release. At this point, the reliance interest is small because 5.5.0 (and intl v3) has been out for little time, but perhaps, if anything is to be done, other options such as introducing an object type just for encapsulating timestamps would be preferable. -- Gustavo Lopes