From owner-freebsd-bugs Tue Sep 4 16:50: 7 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2143837B405 for ; Tue, 4 Sep 2001 16:50:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f84No1a82317; Tue, 4 Sep 2001 16:50:01 -0700 (PDT) (envelope-from gnats) Date: Tue, 4 Sep 2001 16:50:01 -0700 (PDT) Message-Id: <200109042350.f84No1a82317@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Archie Cobbs Subject: Re: bin/30321: strftime(3) '%s' format does not work properly Reply-To: Archie Cobbs Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/30321; it has been noted by GNATS. From: Archie Cobbs To: Garrett Wollman Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/30321: strftime(3) '%s' format does not work properly Date: Tue, 04 Sep 2001 16:42:38 -0700 Garrett Wollman wrote: > > When it does this conversion, it uses the currently set > > system time zone instead of using the time zone from the > > 'struct tm' argument. Therefore, if the two timezones are > > different, incorrect results are computed. > > This behavior is correct. In the general case, as codified in the ISO > C standard, `struct tm' does not contain time zone information. ISO C > functions such as strftime() are specified to use the system's time > zone. The current behavior of '%s' is inconsistent with every other format character supported by strftime(3). For example, if you use '%z' you get the time zone offset read directly from the struct tm; the system time zone has no effect on that conversion whatsoever. Same for '%H', etc. So at best, it violates POLA and is bizarre, undocumented behavior. -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message