From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from deimos.uberspace.de (deimos.uberspace.de [185.26.156.152]) by sourceware.org (Postfix) with ESMTPS id 3768C3857C4E for ; Fri, 15 Apr 2022 10:10:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3768C3857C4E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jdoubleu.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jdoubleu.de Received: (qmail 19981 invoked by uid 989); 15 Apr 2022 10:10:07 -0000 Authentication-Results: deimos.uberspace.de; auth=pass (plain) Message-ID: <2a909d6a-cdfd-0642-68de-7082c9fb0e0a@jdoubleu.de> Date: Fri, 15 Apr 2022 12:10:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH] add tests for tzset(3) Content-Language: en-US To: newlib@sourceware.org References: <822e81a0-ed9f-200e-3318-0495456ad67e@SystematicSw.ab.ca> <20220407233425.2012-1-Brian.Inglis@SystematicSW.ab.ca> <9603e3aa-bd7d-6740-c710-27ace1d80397@SystematicSw.ab.ca> <25cfc7a2-2c66-f9fe-581b-8d3cec5d3bd9@jdoubleu.de> <15976fc5-2260-5fa7-ff4d-48ca8a640d59@SystematicSw.ab.ca> From: jdoubleu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Bar: --- X-Rspamd-Report: BAYES_HAM(-2.992474) MIME_GOOD(-0.1) X-Rspamd-Score: -3.092474 Received: from unknown (HELO unkown) (::1) by deimos.uberspace.de (Haraka/2.8.28) with ESMTPSA; Fri, 15 Apr 2022 12:10:07 +0200 X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Apr 2022 10:10:11 -0000 On Thu, Apr 14, 2022 at 12:31 PM Brian Inglis wrote: > I am still not hearing from where the requirement originates to set > UTC/GMT/etc or do anything other than leave everything as is. > Is this glibc behaviour, and why not /etc/localtime or /etc/timezone? On 4/14/2022 9:23 PM, Jeff Johnston wrote: > It is glibc behaviour as I mentioned in my note. The following is also > from man tzset Aside from glibc, the BSD man page[1] also states: > If the TZ environment variable [..] cannot be interpreted as a direct specification, UTC is used. Where "direct specification" is the formatted string. The POSIX standard does not seem to explicitly state what happens in an error case, besides[2]: > The interpretation of these fields is unspecified if either field is less than three bytes [..], > more than {TZNAME_MAX} bytes, or if they contain characters other than those specified.and[3] > If TZ is absent from the environment, implementation-defined default timezone information shall be used. [1]: https://man.openbsd.org/tzset [2]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03 [2]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tzset.html# Cheers --- 🙎🏻‍♂️ jdoubleu On 4/14/2022 9:23 PM, Jeff Johnston wrote: > On Thu, Apr 14, 2022 at 12:31 PM Brian Inglis < > Brian.Inglis@systematicsw.ab.ca> wrote: > >> I am still not hearing from where the requirement originates to set >> UTC/GMT/etc or do anything other than leave everything as is. >> Is this glibc behaviour, and why not /etc/localtime or /etc/timezone? >> >> > It is glibc behaviour as I mentioned in my note. The following is also > from man tzset > > If the TZ variable does not appear in the environment, the tzname > vari‐ > able is initialized with the best approximation of local wall > clock > time, as specified by the tzfile(5)-format file localtime found in > the > system timezone directory (see below). (One also often > sees > /etc/localtime used here, a symlink to the right file in the > system > timezone directory.) > > If the TZ variable does appear in the environment but its value > is > empty or its value cannot be interpreted using any of the formats > spec‐ > ified below, Coordinated Universal Time (UTC) is used. > > Note about if its value is specified and cannot be interpreted using any of > the formats specified. > If there is an error, then that clause would apply. In glibc's case, it is > less than 3 chars and invalid > chars. In our case, exceeding the max limit would also apply. > > From glibc: tzset.c > > /* Clear out old state and reset to unnamed UTC. */ > memset (tz_rules, '\0', sizeof tz_rules); > tz_rules[0].name = tz_rules[1].name = ""; > > /* Get the standard timezone name. */ > if (parse_tzname (&tz, 0) && parse_offset (&tz, 0)) > > If the parse_tzname fails or parsing the dst name fails, unnamed UTC is > used. > > -- Jeff J. >