Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98381 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73946 invoked from network); 2 Mar 2017 15:57:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Mar 2017 15:57:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=andreas@heigl.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=andreas@heigl.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain heigl.org designates 195.191.240.18 as permitted sender) X-PHP-List-Original-Sender: andreas@heigl.org X-Host-Fingerprint: 195.191.240.18 hos109.unaxus.net Received: from [195.191.240.18] ([195.191.240.18:35764] helo=hos109.unaxus.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/56-20342-ED048B85 for ; Thu, 02 Mar 2017 10:57:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=heigl.org; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=nsQ2CIhweKHpr3DerOPloaku2lEvcuYuxYKr5z/IP28=; b=Fo+WITr2lC+HAOvyXsgxVbxiFu NC1PoJSJFP9gN+Q7YOrCqVjP0ZAuCyavbPKFwmSRnPgRAg3gnFjsWnXkmAcrB0ruh+Mw/MaHHljR4 GSz8R39m1sQqbUVEF3JTbdwSB0UChhG12YJJVpUYK++uMxk5XcYvjMsQiC0wwXHuhDqN9Kz78QC8M wMwLSvh+UDZXoglx29/z04LM37HLCfrP19QDnIgxgXEcGQf+yJhHjr6JMkc4MDQzZa5i6hiCKGAoi a6IK5+YeCX6gudZ+AYW9ML8w9NqfB3wNdoNckUhWgla2bwaPKLoPh/qrnZEONBG+nd2a4hM3Mxawo UAY5IzGw==; Received: from [212.185.30.151] (port=62266 helo=wdv-hg-0.C.07-zX4090-Heigl.Andreas.dhcp.hg.wdv.de) by hos109.unaxus.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.88) (envelope-from ) id 1cjT6Q-001fJ8-Sw; Thu, 02 Mar 2017 16:57:14 +0100 To: Crocodile , PHP Internals References: Message-ID: Date: Thu, 2 Mar 2017 16:57:14 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="------------ms080701060504070805080007" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hos109.unaxus.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - heigl.org X-Get-Message-Sender-Via: hos109.unaxus.net: authenticated_id: a.heigl+heigl.org/only user confirmed/virtual account not confirmed X-Authenticated-Sender: hos109.unaxus.net: a.heigl@heigl.org Subject: Re: [PHP-DEV] New constants in DateTime From: andreas@heigl.org (Andreas Heigl) --------------ms080701060504070805080007 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Am 02.03.17 um 16:46 schrieb Crocodile: > While I agree with everything you're saying, I also think it could stil= l be > worth it to have those constants in core for the following reasons: >=20 > 1. MINUTE, HOUR and DAY are particularly often used, 99.999% of the tim= e in > a context where it does not matter if a minute has 60 seconds or not, o= r if > a day has 24h or not. Particularly often used to specify cache lifetime= , > for example. IMO they then should be part of the caching (or whatever)-implementation and not of DateTime. As *when* they are part of DateTime they will be used in a DateTime-context *where they shouldn't be used*! > 2. It's surely easy to implement them in userland but that would requir= e > either global constants or a class in userland specifically for that > purpose. Both ways are easy, but these constants I see in virtually any= > project, so for me it would be handy to have them in DateTime. When you need them use a Constant-Class or create a composer package that contains your constants and require that. https://3v4l.org/5MW7O That's much more extensible than having them in the core and needing to maintain them for everyone=E2=80=A6 But as I said: just my 0.02=E2=82=AC Cheers Andreas >=20 > But of course, I don't see it as a must-have, just as nice-to-have. >=20 > Cheers, > Victor >=20 > On Thu, Mar 2, 2017 at 4:03 PM Andreas Heigl wrote:= >=20 >> Hi Victor. >> >> >> Am 02.03.17 um 15:48 schrieb Crocodile: >>> Hello internals, >>> >>> A similar question should have been asked already but I haven't found= >>> anything so far when googling: I think DateTime class should have the= >>> following constants in addition to those already existing: >>> >>> const SQL =3D "Y-m-d H:i:s"; >>> const SQL_DATE =3D "Y-m-d"; >>> const SQL_TIME =3D "H:i:s"; >>> const SECOND =3D 1; >>> const MINUTE =3D 60; >> Not every minute has 60 seconds. >>> const HOUR =3D 3600; >> See above! >>> const DAY =3D 86400; >> Not every day has 86400 seconds. For one see the comment on MINUTE and= >> also there are days that have more or less than 24 hours (DST) >> >> Therefore I wouldn't want to see those constants (that are also very >> easy to put up in userland - even though they aren't correct) in the >> PHP-Core. >> >> And as the SQL-Constants are also easily to implement in userland I'm >> not sure it makes to add them to the core=E2=80=A6 >> >> But that's just my 0.02=E2=82=AC >> >> Cheers >> >> Andreas >> >> >> -- >> ,,, >> (o o) >> +---------------------------------------------------------ooO-(_)-Ooo-= + >> | Andreas Heigl = | >> | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2= =B023'58" | >> | http://andreas.heigl.org http://hei.gl/wiFKy7 = | >> +---------------------------------------------------------------------= + >> | http://hei.gl/root-ca = | >> +---------------------------------------------------------------------= + >> >> -- > Best regards, > Victor Bolshov >=20 --=20 ,,, (o o) +---------------------------------------------------------ooO-(_)-Ooo-+ | Andreas Heigl | | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2=B0= 23'58" | | http://andreas.heigl.org http://hei.gl/wiFKy7 | +---------------------------------------------------------------------+ | http://hei.gl/root-ca | +---------------------------------------------------------------------+ --------------ms080701060504070805080007 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCC BawwggWoMIIDkKADAgECAgMSOD4wDQYJKoZIhvcNAQENBQAweTEQMA4GA1UEChMHUm9vdCBD QTEeMBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0IFNp Z25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2VydC5vcmcwHhcN MTYwNzIzMDkxNjU1WhcNMTgwNzIzMDkxNjU1WjBcMRYwFAYDVQQDEw1BbmRyZWFzIEhlaWds MSAwHgYJKoZIhvcNAQkBFhFhLmhlaWdsQGhlaWdsLm9yZzEgMB4GCSqGSIb3DQEJARYRYW5k cmVhc0BoZWlnbC5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCn6XLcWFLD vAXgllUikBAU2Rv63m7ZKP+ZU/2HTWDW0BJ2muK7GD3cGZxbKKosO6l6PSqqmLqUJ8G6b/85 iPQmNL5z+LG/+wt/p31SOMAWc5UA7CJAQ9pivUCcV+Yt0LzoxWO5ME2rEZ/ioB2tXMilkJLM U4f5A9m3YZVSKj3xbM7rIpQEZiK0TrZ4MchTwPMdAwBLBxCoAztcg4Yj4qKd+IQLff0Ldhc5 3tc9b+XT7YzWLY5rQKHE+hKqIAdvYfqqKQZFHBBXptSXUXBeYK5a4UT0fpnMP7toqr/9mLlK +FvDNeVwSo5I/abiqdek1lH0/xwYy9im8k4SRtLTAp7hAgMBAAGjggFUMIIBUDAMBgNVHRMB Af8EAjAAMFYGCWCGSAGG+EIBDQRJFkdUbyBnZXQgeW91ciBvd24gY2VydGlmaWNhdGUgZm9y IEZSRUUgaGVhZCBvdmVyIHRvIGh0dHA6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