From owner-freebsd-bugs Thu Nov 11 22:20: 6 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 7285914D6E for ; Thu, 11 Nov 1999 22:20:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id WAA71041; Thu, 11 Nov 1999 22:20:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Date: Thu, 11 Nov 1999 22:20:02 -0800 (PST) Message-Id: <199911120620.WAA71041@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Valentin Nechayev Subject: Re: bin/14813: Perl POSIX::strftime bugfeature Reply-To: Valentin Nechayev Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/14813; it has been noted by GNATS. From: Valentin Nechayev To: "Andrey A. Chernov" Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/14813: Perl POSIX::strftime bugfeature Date: Fri, 12 Nov 1999 08:12:03 +0200 Hello Andrey A. Chernov! Thu, Nov 11, 1999 at 15:04:23, ache wrote about "Re: bin/14813: Perl POSIX::strftime bugfeature": > On Wed, Nov 10, 1999 at 09:12:44PM +0200, Valentin Nechayev wrote: > > Disable the mktime() call in POSIX::strftime. Also disable init_tm(), > > whis is really localtime(time()) - IMHO the better solution for FreeBSD > > in case of tm_gmtoff & tm_zone patameters is to set them to most safe value, > > i.e. 0. > > What about just replacing mktime() with timegm()? It seems to produce correct > results, but I not check it. No, it is bad also. In that variant, it will print correctly GMT time, but incorrectly local time, possibly ;( (Consider variant, where timegm() normalizes time with tm_isdst==1. What shall happen? If you know current timegm() behavior, it can change.) Also, timegm() AFAIR exists not in all unices. IMHO, the only normal variant is to disable this call. There is another, ideological basis of disabling: every subroutine must do its own work and must produce minimum of side effects. Goal of strftime() is to print time and date according to given format, it must not normalize or convert time. If I ask it to print 31th of February, it must print this date literally. If I want normalize data, I can do it by special normalizing call, i.e., mktime() or timegm() accordingly to my knowledge of this date origin. -- NVA To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message