Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Nov 1999 22:20:02 -0800 (PST)
From:      Valentin Nechayev <netch@lucky.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/14813: Perl POSIX::strftime bugfeature
Message-ID:  <199911120620.WAA71041@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/14813; it has been noted by GNATS.

From: Valentin Nechayev <netch@lucky.net>
To: "Andrey A. Chernov" <ache@FreeBSD.ORG>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911120620.WAA71041>