From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) by sourceware.org (Postfix) with ESMTPS id 993FF395B065 for ; Sat, 17 Sep 2022 05:00:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 993FF395B065 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSW.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=systematicsw.ab.ca Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTP id ZINIoADqMSp39ZPwCoUQfm; Sat, 17 Sep 2022 05:00:20 +0000 Received: from localhost.localdomain ([184.64.124.72]) by cmsmtp with ESMTP id ZPwAopt2tg786ZPwCoOIVk; Sat, 17 Sep 2022 05:00:20 +0000 X-Authority-Analysis: v=2.4 cv=a94jSGeF c=1 sm=1 tr=0 ts=63255464 a=oHm12aVswOWz6TMtn9zYKg==:117 a=oHm12aVswOWz6TMtn9zYKg==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=9pJ1AMZdf05kdrFBZ94A:9 a=QEXdDO2ut3YA:10 a=dmFWhoLbThZFLoyzdvQA:9 a=B2y7HmGcmWMA:10 From: Brian Inglis To: Newlib Subject: [PATCH 2/2] strptime.c(strptime_l): add %i, %q, %v Date: Fri, 16 Sep 2022 23:00:04 -0600 Message-Id: <20220917050005.5758-3-Brian.Inglis@SystematicSW.ab.ca> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220917050005.5758-1-Brian.Inglis@SystematicSW.ab.ca> References: <20220917050005.5758-1-Brian.Inglis@SystematicSW.ab.ca> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.37.2" Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfBpOatkk0F6k6naSLbB0JHcTojTrXAP3WgkZvMSZTqHIWjjvtcd9LEnl83b5QyR0RYKPebSlOfQceqkxHwjobguZ/IvLdJ3J6YDCFCYaw8gRvzmxkX6k QYXBgTg1KnmgBlarUtnGoS/K1A62rPRzcQOBB/pW/RvjlPcsXwuV7scstJhpCclEtTA3GMpVLD5H6EIw8Gv55fscl8XmFrUl+nJkr4NYtE/aX3YlK9xUs9Bh cHqhw5z8Gpr+/5XrtVGXExKk0wx7orDDftaeOoZb5e8= X-Spam-Status: No, score=-1169.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,PP_MIME_FAKE_ASCII_TEXT,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is a multi-part message in MIME format. --------------2.37.2 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit newlib/libc/time/strptime.c(strptime_l): %i year in century [00..99] Synonym for "%y". Non-POSIX extension. [tm_year] %q GNU quarter of the year (from `<<1>>' to `<<4>>') [tm_mon] %v OSX/Ruby VMS/Oracle date "%d-%b-%Y". Non-POSIX extension. [tm_mday, tm_mon, tm_year]: --- newlib/libc/time/strptime.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --------------2.37.2 Content-Type: text/x-patch; name="0002-strptime.c-strptime_l-add-i-q-v.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0002-strptime.c-strptime_l-add-i-q-v.patch" diff --git a/newlib/libc/time/strptime.c b/newlib/libc/time/strptime.c index 12b2ef4695de..5e64af262516 100644 --- a/newlib/libc/time/strptime.c +++ b/newlib/libc/time/strptime.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999 Kungliga Tekniska H?gskolan + * Copyright (c) 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -298,6 +298,14 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr, } else timeptr->tm_hour += 12; break; + case 'q' : /* quarter year - GNU extension */ + ret = strtol_l (buf, &s, 10, locale); + if (s == buf) + return NULL; + timeptr->tm_mon = (ret - 1)*3; + buf = s; + ymd |= SET_MON; + break; case 'r' : /* %I:%M:%S %p */ s = strptime_l (buf, _ctloc (ampm_fmt), timeptr, locale); if (s == NULL) @@ -365,6 +373,13 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr, buf = s; ymd |= SET_WDAY; break; + case 'v' : /* %d-%b-%Y - OSX/Ruby extension VMS/Oracle date */ + s = strptime_l (buf, "%d-%b-%Y", timeptr, locale); + if (s == NULL || s == buf) + return NULL; + buf = s; + ymd |= SET_YMD; + break; case 'U' : ret = strtol_l (buf, &s, 10, locale); if (s == buf) @@ -402,6 +417,7 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr, return NULL; buf = s; break; + case 'i' : /* Non-POSIX extension. */ case 'y' : ret = strtol_l (buf, &s, 10, locale); if (s == buf) --------------2.37.2--