Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121497 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20291 invoked from network); 28 Oct 2023 16:32:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Oct 2023 16:32:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4B35B1804BC for ; Sat, 28 Oct 2023 09:32:20 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS9370 160.16.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 28 Oct 2023 09:32:19 -0700 (PDT) Received: from smtpclient.apple (softbank060067217005.bbtec.net [60.67.217.5]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id BBB344012B; Sun, 29 Oct 2023 01:32:17 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1698510737; bh=bBA2KqZGntMSNvUQ4MukOROyrO73bQGHM1q6sJ+iBJI=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=ZbH6cE2oznl+xvw4MCq07/whblUdYfc5amESmol3LB6ACnT41x33a8ONwtdHiOXJW fxVxMG9/Lk+/ceuJ0Lz744qNsMXrLS2KrbxEXhDdLNRfB2qGJ/WPqG79tOdYE16hXe lbMnuO/9BFJprdHIoTPT3q1BQ/a/bMoHD/XU+b2s= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Date: Sun, 29 Oct 2023 01:32:05 +0900 Message-ID: <505DD7E0-A720-4357-A22F-2F7B42EEE9F3@sakiot.com> References: Cc: internals@lists.php.net In-Reply-To: To: Marc X-Mailer: iPhone Mail (21A360) Subject: Re: [PHP-DEV] New DateTime[Immutable]::createFromTimestamp From: saki@sakiot.com (Saki Takamachi) Hi Marc, > On a 64bit system it's obvious to have higher precision if you handle the i= nteger and fractions part separately (as timelib does) but this doesn't help= if you already have a floating point number at hand. Also JS uses a double f= loat for timestamps in milliseconds which is the most used lang together wit= h PHP and there is tons of code out there who does a simple */ 1000 to pass a= date-time to/from JS, which I wouldn't necessary decline. I think there is no problem if it is up to milliseconds. This becomes a prob= lem when it includes up to microseconds. Another problem is that there are "millisecond" and "microsecond" timestamp f= ormats that do not include dots, how should they be handled? In reality, suc= h a use case is unlikely, but it is virtually impossible to tell the differe= nce between the two:=20 timestamp: 1698510347 =3D> second: 2023-10-28 16:25:47(UTC) =3D> millisecond: 1970-01-20 15:48:30.347(UTC) > PS: I didn't add a timezone argument here because a unix timestamp is in U= TC by definition and changing the TZ is just one `setTimezone` call away not= having to deal with any default/system/ini TZ setting. Right. There is no need to consider time zones for timestamps. Regards. Saki=