On Sat, Sep 27, 2008 at 12:26 PM, Ilia Cheishvili <[EMAIL PROTECTED]> wrote: > Ah, I see. I like that even better :) > And I attached yet another patch that incorporates your idea.
thanks. I did some more code-digging, and it looks, like proper point for fixing is not here, anyway. It should be in timelib_unixtime2gmt() and timelib_unixtime2local() funcitons of ext/date/lib/unixtime2tm.c "->f" member of structure is not set there, which results in zero's in output. date() function is an abstraction and should not deal with such details itself. > > On Sat, Sep 27, 2008 at 2:20 AM, Alexey Zakhlestin <[EMAIL PROTECTED]> > wrote: >> >> On Sat, Sep 27, 2008 at 12:04 PM, Ilia Cheishvili >> <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> >> > wrote: >> >> >> >> On Sat, Sep 27, 2008 at 11:04 AM, Ilia Cheishvili >> >> <[EMAIL PROTECTED]> 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/ > > -- Alexey Zakhlestin http://blog.milkfarmsoft.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php