From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) by sourceware.org (Postfix) with ESMTPS id 37F81385780A for ; Mon, 16 Nov 2020 22:30:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 37F81385780A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=brian.inglis@systematicsw.ab.ca Received: from [192.168.1.104] ([24.64.172.44]) by shaw.ca with ESMTP id en1UkPt9g34axen1VklAOC; Mon, 16 Nov 2020 15:30:57 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5fb2fda1 a=kiZT5GMN3KAWqtYcXc+/4Q==:117 a=kiZT5GMN3KAWqtYcXc+/4Q==:17 a=IkcTkHD0fZMA:10 a=CjxXgO3LAAAA:8 a=ZqF515WzAAAA:20 a=94nOnFI1EgyDtX4ev68A:9 a=QEXdDO2ut3YA:10 a=8xPuELMIaLgA:10 Reply-To: newlib@sourceware.org To: newlib@sourceware.org References: <080401d6bada$6c52f060$44f8d120$.ref@yahoo.com> <080401d6bada$6c52f060$44f8d120$@yahoo.com> <20201116151359.GD41926@calimero.vinschen.de> From: Brian Inglis Organization: Systematic Software Subject: Re: [PATCH] Add support for TZ names with <> in tzset Message-ID: <3a5f706a-f1c0-595f-ff96-e674cb72e233@SystematicSw.ab.ca> Date: Mon, 16 Nov 2020 15:30:56 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: <20201116151359.GD41926@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfHrUtTD5Udns7ASV/VIo2+gcclYPzemj4BwH0X7z+J6aUsW8VyS2fyrU8ZjbL54ja4WIavD0Bqowqe0iC9ggfiVGi174tqUk3y4I5/jngm/DNgoMtyl0 ufUdaATyd2CmBe0HXajO/4FnU9+365acubiuT4MOEKDGJKFBeTs06HtuNQapmkqUWFIkyTULwrBjRPLcEMKGzNzgatNPoni9IQ4= X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Mon, 16 Nov 2020 22:30:59 -0000 On 2020-11-16 08:13, Corinna Vinschen via Newlib wrote: > Hi Earle, > > On Nov 14 15:03, Earle F. Philhower, III via Newlib wrote: >> Howdy all, >> >> Attached is a patch which extends the tzset() function to support a format >> for "unnamed" TZ environment timezones which use "<+/-nn>" as the timezone >> name instead of an alphabetic name. These are supported in glibc and are >> present in several major TZ databases that we use on the ESP8266 Arduino >> core. For example, >> >>> #define TZ_Africa_Casablanca "<+01>-1" >> >> The existing tzset sscanf format string breaks at the first "+", assuming >> it's the >> beginning of the offset. This patch special-cases names beginning with "<" >> to >> circumvent the issue. >> >> Signed-off-by: Earle F. Philhower, III > > Basically this looks ok. I have two nits, though. > > - Now that the scanning got more complicated than a single sscanf call, > this crys out for a helper function doing the actual scanning for > both, std and dst strings. This could be an inline function which is > only inlined > #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) > > - The strcat call seems a bit heavy. What about sth like this instead: > > __tzname_ptr[n - 1] = '>'; > __tzname_ptr[n] = '\0'; Should consider modifying the PD TZ project tzcode reference src localtime.c tzparse() https://github.com/eggert/tz/blob/master/localtime.c#L1069 (contributed to the public domain by Guy Harris): handles all the POSIX rules string edge cases to Paul Eggert's satisfaction, and gets patched if any upstream org (every distro) or vendor (all OSes) reports a problem. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. [Data in binary units and prefixes, physical quantities in SI.]