Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40731 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35000 invoked from network); 27 Sep 2008 08:20:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2008 08:20:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.46.30 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 74.125.46.30 yw-out-2324.google.com Received: from [74.125.46.30] ([74.125.46.30:58120] helo=yw-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/B0-30545-EDCEDD84 for ; Sat, 27 Sep 2008 04:20:47 -0400 Received: by yw-out-2324.google.com with SMTP id 5so227444ywb.83 for ; Sat, 27 Sep 2008 01:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=HYD/SvhiZJPr6To/2S6pM2doy7pQgyiZoiE2UvZJuIg=; b=KAYUS+PJqpy9h0LE2V/TjUrqqbCg7C/R2T+HMV9GgnBxeWHxPDIUo9fFqJgRhPwC+m Gyq8YbprcAWrNBQAYtLMKKSNrkuWWPy/enE/fUbOSqMk1qeWcCJobEs3SQ416j3FL+Xz 9/nKeK3SN8h4Yhh955IV3kJ1DfIwYFsEab2B4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=MST6XaS//pX653ji1C4H6f9FFC2FyEzXlH1dV8zy7U1FyT7UPtwbTISCHIQuzvcbQb TF2vAnNO0UtWu0Of71pqtiCFNHChSismRgb8infq+1u2Rz9vpLb/r54f6v1bDV10QdgQ Ya0SHOWOW96nYGfDtEJMprIXmuGpZPRhH88Ds= Received: by 10.150.140.6 with SMTP id n6mr3596065ybd.31.1222503642111; Sat, 27 Sep 2008 01:20:42 -0700 (PDT) Received: by 10.150.186.11 with HTTP; Sat, 27 Sep 2008 01:20:42 -0700 (PDT) Message-ID: Date: Sat, 27 Sep 2008 12:20:42 +0400 To: "Ilia Cheishvili" Cc: "PHP internals" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Subject: Re: [PHP-DEV] [PATCH] Fix date() bug From: indeyets@gmail.com ("Alexey Zakhlestin") On Sat, Sep 27, 2008 at 12:04 PM, Ilia Cheishvili wrote: > It definitely would be, and that's actually the way I would have preferred > to do it. I didn't want to impact too much code, if that makes sense in > this case, but I'm glad that someone agrees :) > I have attached a patch to do exactly this. I was thinking other in another direction.. case 'u': #ifdef HAVE_GETTIMEOFDAY gettimeofday(&tp, &tz); length = slprintf(buffer, 32, "%06d", (int) tp.tv_usec); #else length = slprintf(buffer, 32, "%06d", (int) floor(t->f * 1000000)); #endif break; > > On Sat, Sep 27, 2008 at 1:40 AM, Alexey Zakhlestin > wrote: >> >> On Sat, Sep 27, 2008 at 11:04 AM, Ilia Cheishvili >> wrote: >> > Hi all, >> > This patch addresses the issue with the date() function. When passing >> > in a >> > 'u', the date() function simply outputs six zeros. To fix this, I added >> > a >> > gettimeofday() call that figures out what to display for microseconds. >> > I am >> > including the headers and using the function with pre-processor >> > safeguards >> > as well. >> > Take a look :) >> >> Wouldn't it be better, to make gettimeofday() call only in case of 'u'? >> >> >> -- >> Alexey Zakhlestin >> http://blog.milkfarmsoft.com/ > > -- Alexey Zakhlestin http://blog.milkfarmsoft.com/