Assaf Gordon <assafgordon@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Assaf Gordon <assafgordon@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Received: (at 14097) by debbugs.gnu.org; 22 Nov 2013 08:50:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 22 03:50:19 2013 Received: from localhost ([127.0.0.1]:37947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1VjmRO-0003sm-65 for submit <at> debbugs.gnu.org; Fri, 22 Nov 2013 03:50:18 -0500 Received: from mail-ie0-f174.google.com ([209.85.223.174]:40492) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <mihai@HIDDEN>) id 1VjmRK-0003sT-Pq for 14097 <at> debbugs.gnu.org; Fri, 22 Nov 2013 03:50:15 -0500 Received: by mail-ie0-f174.google.com with SMTP id at1so1581370iec.5 for <14097 <at> debbugs.gnu.org>; Fri, 22 Nov 2013 00:50:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=HVLRw4dy4VTa2YiMGLFFG/NcdTPNu3uxvqcHxIGnwuM=; b=BhrNo31gehdmTFhYQ9jr9AcF3Tw0nbmtXLVRfIshe8FIEXXufYaBXbSpScaJjEQWYk 8lPfnjaORcA2l0FIKdQo2fq9XeSEok3QMCwnAyeRK9DnAg2BnrB34rMEu2VerK1k2WBP 3mLuS/m2d50+gfpyJKZ++F/cjAKs+CeEnTMlqVJQWNsGJ6vy0lXL33TXgLL0PGoisw6d rEzfQwU2ioxV55eO3FQdBIyfn4ibYPx6NxN/5cW/F2QwAkkD3pRlfWXc4lXIeEua75DW 2CaGTp3VwBMASFZqp6TXaN/9YMhqEcRyZqgLNwFzsKEJUaB2HraKbwPRS4Vo44hruks1 zIbw== X-Gm-Message-State: ALoCoQlL3P8nAkBJmVEHfWGKGAGpUlLQttSPajm2wCCvte64wgO/xmp2oMaD8FeNkjUmpbHJCnFU MIME-Version: 1.0 X-Received: by 10.50.50.70 with SMTP id a6mr1499304igo.1.1385110209014; Fri, 22 Nov 2013 00:50:09 -0800 (PST) Received: by 10.64.238.66 with HTTP; Fri, 22 Nov 2013 00:50:08 -0800 (PST) In-Reply-To: <CADyhzG2MZ6KYceTVscRrhi9zWWGkEFupxSCQhuvxHkMeWMk4qQ@HIDDEN> References: <51785671.1080300@HIDDEN> <1375721473-14714-1-git-send-email-mihai@HIDDEN> <CADyhzG2MZ6KYceTVscRrhi9zWWGkEFupxSCQhuvxHkMeWMk4qQ@HIDDEN> Date: Fri, 22 Nov 2013 09:50:08 +0100 Message-ID: <CADyhzG1UqgrXF79TN0+MDd79RdG5qhGhvFqN3rdBPf4+z5x9mw@HIDDEN> Subject: Re: [PATCH v2] Add support for ISO 8601 basic format From: =?UTF-8?Q?Mihai_Capot=C4=83?= <mihai@HIDDEN> To: eggert@HIDDEN Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 14097 Cc: 14097 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.7 (/) On Sat, Aug 31, 2013 at 5:31 PM, Mihai Capot=C4=83 <mihai@HIDDEN> wrote: > Could someone please review the new patch? Anybody?
bug-coreutils@HIDDEN:bug#14097; Package coreutils.
Full text available.
Received: (at 14097) by debbugs.gnu.org; 31 Aug 2013 15:31:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 31 11:31:18 2013
Received: from localhost ([127.0.0.1]:33330 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1VFn8v-0005A8-94
for submit <at> debbugs.gnu.org; Sat, 31 Aug 2013 11:31:17 -0400
Received: from mail-wg0-f52.google.com ([74.125.82.52]:46960)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from <mihai@HIDDEN>) id 1VFn8s-00059t-AX
for 14097 <at> debbugs.gnu.org; Sat, 31 Aug 2013 11:31:15 -0400
Received: by mail-wg0-f52.google.com with SMTP id m14so608817wgh.31
for <14097 <at> debbugs.gnu.org>; Sat, 31 Aug 2013 08:31:08 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:mime-version:in-reply-to:references:date
:message-id:subject:from:to:cc:content-type
:content-transfer-encoding;
bh=qPVQeUQOqGSRbcl5AJqZ0vRkCcooRouAk7StBljXNJE=;
b=evB0ElaLamleys7MvZWPoFqsiVw/9lCLKDjyI8ibh1LIIIiuFgikiG+0yrgKeqd69E
cyqNrJybno9uBaIuDfC32VWSLtuU5C0TyepcV90MbY9/z6areCYFcS9gh6AUakRQGHy1
BDAP2CMRwx6Nr1EMSe6+TxCCrGJQqDC7oOFAEgaPRFvPE2kHdJhUkvKk11B4HFKkyK/o
XAwIGQ9i8x98TrQbm5j8ol/e9bXxdiLoXlJOrtugCQOijTAlABoA8Lz5hITkHMtlRXOv
9aW7/S61WVL4VFHNNgj+Jo7V3sEbtGn041F0bncofpExYH7q1jULArcHI4fxc2UYiDih
N9RA==
X-Gm-Message-State: ALoCoQlhhy3GMUg/RNALOXya3nHdWOdZ0ty/KVOoEiNUO98lXEdQAiol68e/hCEuHmtaglfiYX88
MIME-Version: 1.0
X-Received: by 10.180.78.229 with SMTP id e5mr6647015wix.58.1377963068352;
Sat, 31 Aug 2013 08:31:08 -0700 (PDT)
Received: by 10.216.196.72 with HTTP; Sat, 31 Aug 2013 08:31:08 -0700 (PDT)
In-Reply-To: <1375721473-14714-1-git-send-email-mihai@HIDDEN>
References: <51785671.1080300@HIDDEN>
<1375721473-14714-1-git-send-email-mihai@HIDDEN>
Date: Sat, 31 Aug 2013 17:31:08 +0200
Message-ID: <CADyhzG2MZ6KYceTVscRrhi9zWWGkEFupxSCQhuvxHkMeWMk4qQ@HIDDEN>
Subject: Re: [PATCH v2] Add support for ISO 8601 basic format
From: =?UTF-8?Q?Mihai_Capot=C4=83?= <mihai@HIDDEN>
To: eggert@HIDDEN
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 14097
Cc: 14097 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)
Could someone please review the new patch?
On Mon, Aug 5, 2013 at 6:51 PM, Mihai Capot=C4=83 <mihai@HIDDEN> wrote:
> The parser now accepts the basic format for combined date and time
> representations, which ommits the date and time separators, "-" and ":".
>
> See bug 23767 for GNU coreutils, <https://savannah.gnu.org/bugs/?23767>.
>
> * lib/parse-datetime.y: Parse combined date and time representations in
> ISO 8601 basic format.
> (set_hhmmss_iso_8601_basic_time) New function.
> (digits_iso_8601_basic_to_date) New function.
> * tests/test-parse-datetime.c: Add tests for combined date and time
> representations in ISO 8601 basic format.
> * doc/parse-datetime.texi Document support for combined date and time
> representations in ISO 8601 basic format.
>
> Signed-off-by: Mihai Capot=C4=83 <mihai@HIDDEN>
> ---
> On Thu, Apr 25, 2013 at 12:02 AM, Paul Eggert <eggert@HIDDEN> wrote:
>> The most important thing is that the patch also needs
>> to update doc/parse-datetime.texi.
>
> Done.
>
>> On 03/30/13 12:18, Mihai Capot=C4=83 wrote:
>>> + /* not ISO 8601 time, forcing mktime error */
>>> + pc->hour =3D 90;
>>
>> How does this force a mktime error? mktime allows tm_hour =3D=3D 90.
>
> I meant to say mktime_ok. I changed the code to reject input by increment=
ing times_seen, like time_zone_hhmm.
>
>>> datetime:
>>> iso_8601_datetime
>>> + | iso_8601_basic_datetime
>>> ;
>>>
>>> iso_8601_datetime:
>>> iso_8601_date 'T' iso_8601_time
>>> ;
>>>
>>> +iso_8601_basic_datetime:
>>> + number 'T' iso_8601_basic_time
>>> + { pc->dates_seen--; } /* already incremented in digits_to_date_t=
ime */
>>
>> This doesn't look right. 'number' accepts all sort of things that we
>> would rather not accept here.
>
> I was trying to make use of the existing digits_to_date_time function. I =
replaced it with tUNUMBER and a new function.
>
>> Conversely, why require ":" in times to
>> correlate with "-" in dates? Shouldn't we accept a "-"less date along
>> with a ":"ful time, and vice versa?
>
> No, that is not allowed by the standard.
>
>> And that "dates_seen--" business
>> is a hack; can't we arrange things so that dates_seen is incremented
>> just once?
>
> The hack is gone.
>
>>> +iso_8601_basic_time:
>>> + tUNUMBER o_zone_offset
>>> + {
>>> + set_hhmmss_iso_8601_basic_time (pc, $1.value, 0);
>>> + pc->meridian =3D MER24;
>>> + }
>>> + | tUDECIMAL_NUMBER o_zone_offset
>>> + {
>>> + /* FIXME avoid time_t to long int cast */
>>
>> Why is the cast needed? Also, can't the grammar be simplified
>> here, by using unsigned_seconds instead of using both
>> tUDECIMAL_NUMBER and tUNUMBER?
>
> I switched to using unsigned_seconds.
>
> doc/parse-datetime.texi | 9 +++++-
> lib/parse-datetime.y | 68 +++++++++++++++++++++++++++++++++++++=
++++--
> tests/test-parse-datetime.c | 61 +++++++++++++++++++++++++++++++++++++=
+
> 3 files changed, 135 insertions(+), 3 deletions(-)
>
> diff --git a/doc/parse-datetime.texi b/doc/parse-datetime.texi
> index 6b3e973..9aa87ed 100644
> --- a/doc/parse-datetime.texi
> +++ b/doc/parse-datetime.texi
> @@ -327,7 +327,12 @@ The ISO 8601 date and time of day extended format co=
nsists of an ISO
> day. This format is also recognized if the @samp{T} is replaced by a
> space.
>
> -In this format, the time of day should use 24-hour notation.
> +The ISO 8601 basic format is also recognized. It is identical to the ISO=
8601
> +extended format, except for omitting the @samp{-} separator in the date =
and the
> +@samp{:} separator in the time. Only the HHMMSS format is supported for =
the
> +time of day, the reduced accuracy HHMM and HH formats are not supported.
> +
> +In these formats, the time of day should use 24-hour notation.
> Fractional seconds are allowed, with either comma or period preceding
> the fraction. ISO 8601 fractional minutes and hours are not
> supported. Typically, hosts support nanosecond timestamp resolution;
> @@ -339,6 +344,8 @@ Here are some examples:
> 2012-09-24T20:02:00.052-0500
> 2012-12-31T23:59:59,999999999+1100
> 1970-01-01 00:00Z
> +20120924T200200.052-0500
> +20121231T235959,999999999+1100
> @end example
>
> @node Day of week items
> diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
> index 4dce7fa..fa9719d 100644
> --- a/lib/parse-datetime.y
> +++ b/lib/parse-datetime.y
> @@ -257,6 +257,38 @@ digits_to_date_time (parser_control *pc, textint tex=
t_int)
> }
> }
>
> +/* Extract into *PC the date info from a string of digits in ISO 8601 ba=
sic
> + format, i.e., YYYYMMHH, YYYY, or YY meaning century. Note that YYYYMM=
is not
> + allowed to avoid confusion with YYMMHH */
> +static void
> +digits_iso_8601_basic_to_date (parser_control *pc, textint text_int)
> +{
> + switch (text_int.digits)
> + {
> + case 8:
> + pc->day =3D text_int.value % 100;
> + pc->month =3D (text_int.value / 100) % 100;
> + pc->year.value =3D text_int.value / 10000;
> + pc->year.digits =3D 4;
> + return;
> + case 4:
> + pc->day =3D 1;
> + pc->month =3D 1;
> + pc->year.value =3D text_int.value;
> + pc->year.digits =3D 4;
> + return;
> + case 2:
> + pc->day =3D 1;
> + pc->month =3D 1;
> + pc->year.value =3D text_int.value * 100;
> + pc->year.digits =3D 4;
> + return;
> + default:
> + pc->dates_seen++;
> + return;
> + }
> +}
> +
> /* Increment PC->rel by FACTOR * REL (FACTOR is 1 or -1). */
> static void
> apply_relative_time (parser_control *pc, relative_time rel, int factor)
> @@ -282,6 +314,28 @@ set_hhmmss (parser_control *pc, long int hour, long =
int minutes,
> pc->seconds.tv_nsec =3D nsec;
> }
>
> +/* Set PC-> hour, minutes, seconds and nanoseconds members from ISO 8601=
basic
> + time. */
> +static void
> +set_hhmmss_iso_8601_basic_time (parser_control *pc, time_t integer_part,
> + long int fractional_part)
> +{
> + if (integer_part / 1000000 > 0)
> + {
> + /* Not ISO 8601 time, arrange to reject it by incrementing
> + pc->times_seen.*/
> + pc->times_seen++;
> + }
> + else
> + {
> + /* FIXME support reduced accuracy times, i.e. HHMM and HH */
> + pc->hour =3D integer_part / 10000;
> + pc->minutes =3D (integer_part % 10000) / 100;
> + pc->seconds.tv_sec =3D integer_part % 100;
> + pc->seconds.tv_nsec =3D fractional_part;
> + }
> +}
> +
> %}
>
> /* We want a reentrant parser, even if the TZ manipulation and the calls=
to
> @@ -290,8 +344,8 @@ set_hhmmss (parser_control *pc, long int hour, long i=
nt minutes,
> %parse-param { parser_control *pc }
> %lex-param { parser_control *pc }
>
> -/* This grammar has 31 shift/reduce conflicts. */
> -%expect 31
> +/* This grammar has 33 shift/reduce conflicts. */
> +%expect 33
>
> %union
> {
> @@ -358,12 +412,22 @@ item:
>
> datetime:
> iso_8601_datetime
> + | iso_8601_basic_datetime
> ;
>
> iso_8601_datetime:
> iso_8601_date 'T' iso_8601_time
> ;
>
> +iso_8601_basic_datetime:
> + tUNUMBER 'T' unsigned_seconds o_zone_offset
> + {
> + digits_iso_8601_basic_to_date (pc, $1);
> + set_hhmmss_iso_8601_basic_time (pc, $3.tv_sec, $3.tv_nsec);
> + pc->meridian =3D MER24;
> + }
> + ;
> +
> time:
> tUNUMBER tMERIDIAN
> {
> diff --git a/tests/test-parse-datetime.c b/tests/test-parse-datetime.c
> index 7eba9ad..c620009 100644
> --- a/tests/test-parse-datetime.c
> +++ b/tests/test-parse-datetime.c
> @@ -216,6 +216,67 @@ main (int argc _GL_UNUSED, char **argv)
> && expected.tv_nsec =3D=3D result.tv_nsec);
>
>
> + /* ISO 8601 basic date and time of day representation,
> + 'T' separator, local time zone */
> + p =3D "20110501T115518";
> + expected.tv_sec =3D ref_time - gmtoff;
> + expected.tv_nsec =3D 0;
> + ASSERT (parse_datetime (&result, p, 0));
> + LOG (p, expected, result);
> + ASSERT (expected.tv_sec =3D=3D result.tv_sec
> + && expected.tv_nsec =3D=3D result.tv_nsec);
> +
> +
> + /* ISO 8601 basic date and time of day representation,
> + 'T' separator, UTC */
> + p =3D "20110501T115518Z";
> + expected.tv_sec =3D ref_time;
> + expected.tv_nsec =3D 0;
> + ASSERT (parse_datetime (&result, p, 0));
> + LOG (p, expected, result);
> + ASSERT (expected.tv_sec =3D=3D result.tv_sec
> + && expected.tv_nsec =3D=3D result.tv_nsec);
> +
> +
> + /* ISO 8601 basic date and time of day representation,
> + 'T' separator, w/UTC offset */
> + p =3D "20110501T115518-0700";
> + expected.tv_sec =3D 1304276118;
> + expected.tv_nsec =3D 0;
> + ASSERT (parse_datetime (&result, p, 0));
> + LOG (p, expected, result);
> + ASSERT (expected.tv_sec =3D=3D result.tv_sec
> + && expected.tv_nsec =3D=3D result.tv_nsec);
> +
> +
> + /* ISO 8601 basic date and time of day representation,
> + 'T' separator, w/hour only UTC offset */
> + p =3D "20110501T115518-07";
> + expected.tv_sec =3D 1304276118;
> + expected.tv_nsec =3D 0;
> + ASSERT (parse_datetime (&result, p, 0));
> + LOG (p, expected, result);
> + ASSERT (expected.tv_sec =3D=3D result.tv_sec
> + && expected.tv_nsec =3D=3D result.tv_nsec);
> +
> +
> + /* ISO 8601 basic date and time of day representation,
> + 'T' separator, w/hour only UTC offset, with ns */
> + p =3D "20110501T115518,123456789-07";
> + expected.tv_sec =3D 1304276118;
> + expected.tv_nsec =3D 123456789;
> + ASSERT (parse_datetime (&result, p, 0));
> + LOG (p, expected, result);
> + ASSERT (expected.tv_sec =3D=3D result.tv_sec
> + && expected.tv_nsec =3D=3D result.tv_nsec);
> +
> +
> + /* Invalid ISO 8601 basic date and time of day representation,
> + too many digits for time */
> + p =3D "20110501T11551800";
> + ASSERT (!parse_datetime (&result, p, 0));
> +
> +
> now.tv_sec =3D 4711;
> now.tv_nsec =3D 1267;
> p =3D "now";
> --
> 1.7.9.5
>
bug-coreutils@HIDDEN:bug#14097; Package coreutils.
Full text available.
Received: (at 14097) by debbugs.gnu.org; 5 Aug 2013 16:51:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 05 12:51:35 2013
Received: from localhost ([127.0.0.1]:41477 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1V6O0M-0001Ar-Hn
for submit <at> debbugs.gnu.org; Mon, 05 Aug 2013 12:51:35 -0400
Received: from mail-wi0-f181.google.com ([209.85.212.181]:56979)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from <mihai@HIDDEN>) id 1V6O0F-0001AD-Lb
for 14097 <at> debbugs.gnu.org; Mon, 05 Aug 2013 12:51:31 -0400
Received: by mail-wi0-f181.google.com with SMTP id en1so1765882wid.2
for <14097 <at> debbugs.gnu.org>; Mon, 05 Aug 2013 09:51:21 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20120113;
h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references
:mime-version:content-type:content-transfer-encoding
:x-gm-message-state;
bh=IUDPiwuBkEJYrTdF73YxYjzzAVjk7gj7J+955GGSHyg=;
b=N597QHPSr7D+bmoKIw3gsVR1D3a0jdkfBVgrGByj8WcwkPZS5g/1Qynk6jRfZh3tnS
jpNpcxkzakaVfN8dpNc6lV5P9osfifLemoTBTgkBwrUcX0N7szr47HVt0o80YQ1lzuZO
hLn4Nx7u48lLg3oDOUaQ0HNjUc/+Hrc3riUwiGstYdId+sX0cH271qbVJQt+7v9GHNoS
Qh8DCi1aKGOXIEDdKEDHBu89nUW7mzQuXsgZtfWlRC2dEhTHfKW6UJrWaAvNjttD0ehu
nDQKX6IJziCKd3z8160XYstTV4Nf6EpZ4AcOqzO2Fup66n8yPIOlT60RxW+D945YNlTP
7v2w==
X-Received: by 10.194.170.227 with SMTP id ap3mr13972174wjc.40.1375721481468;
Mon, 05 Aug 2013 09:51:21 -0700 (PDT)
Received: from dutier.st.ewi.tudelft.nl (dutier.st.ewi.tudelft.nl.
[130.161.159.51])
by mx.google.com with ESMTPSA id j20sm23324wie.7.2013.08.05.09.51.19
for <multiple recipients>
(version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
Mon, 05 Aug 2013 09:51:20 -0700 (PDT)
From: =?UTF-8?q?Mihai=20Capot=C4=83?= <mihai@HIDDEN>
To: eggert@HIDDEN
Subject: [PATCH v2] Add support for ISO 8601 basic format
Date: Mon, 5 Aug 2013 18:51:13 +0200
Message-Id: <1375721473-14714-1-git-send-email-mihai@HIDDEN>
X-Mailer: git-send-email 1.7.9.5
In-Reply-To: <51785671.1080300@HIDDEN>
References: <51785671.1080300@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Gm-Message-State: ALoCoQmjNALuTHGdAfGbx0EMQfhaP+N6x+BfpReuWyZ1gakq47BUvn0WOflieQgEkc+JLwx9GSft
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 14097
Cc: 14097 <at> debbugs.gnu.org, bug-gnulib@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)
The parser now accepts the basic format for combined date and time
representations, which ommits the date and time separators, "-" and ":".
See bug 23767 for GNU coreutils, <https://savannah.gnu.org/bugs/?23767>.
* lib/parse-datetime.y: Parse combined date and time representations in
ISO 8601 basic format.
(set_hhmmss_iso_8601_basic_time) New function.
(digits_iso_8601_basic_to_date) New function.
* tests/test-parse-datetime.c: Add tests for combined date and time
representations in ISO 8601 basic format.
* doc/parse-datetime.texi Document support for combined date and time
representations in ISO 8601 basic format.
Signed-off-by: Mihai Capotă <mihai@HIDDEN>
---
On Thu, Apr 25, 2013 at 12:02 AM, Paul Eggert <eggert@HIDDEN> wrote:
> The most important thing is that the patch also needs
> to update doc/parse-datetime.texi.
Done.
> On 03/30/13 12:18, Mihai Capotă wrote:
>> + /* not ISO 8601 time, forcing mktime error */
>> + pc->hour = 90;
>
> How does this force a mktime error? mktime allows tm_hour == 90.
I meant to say mktime_ok. I changed the code to reject input by incrementing times_seen, like time_zone_hhmm.
>> datetime:
>> iso_8601_datetime
>> + | iso_8601_basic_datetime
>> ;
>>
>> iso_8601_datetime:
>> iso_8601_date 'T' iso_8601_time
>> ;
>>
>> +iso_8601_basic_datetime:
>> + number 'T' iso_8601_basic_time
>> + { pc->dates_seen--; } /* already incremented in digits_to_date_time */
>
> This doesn't look right. 'number' accepts all sort of things that we
> would rather not accept here.
I was trying to make use of the existing digits_to_date_time function. I replaced it with tUNUMBER and a new function.
> Conversely, why require ":" in times to
> correlate with "-" in dates? Shouldn't we accept a "-"less date along
> with a ":"ful time, and vice versa?
No, that is not allowed by the standard.
> And that "dates_seen--" business
> is a hack; can't we arrange things so that dates_seen is incremented
> just once?
The hack is gone.
>> +iso_8601_basic_time:
>> + tUNUMBER o_zone_offset
>> + {
>> + set_hhmmss_iso_8601_basic_time (pc, $1.value, 0);
>> + pc->meridian = MER24;
>> + }
>> + | tUDECIMAL_NUMBER o_zone_offset
>> + {
>> + /* FIXME avoid time_t to long int cast */
>
> Why is the cast needed? Also, can't the grammar be simplified
> here, by using unsigned_seconds instead of using both
> tUDECIMAL_NUMBER and tUNUMBER?
I switched to using unsigned_seconds.
doc/parse-datetime.texi | 9 +++++-
lib/parse-datetime.y | 68 +++++++++++++++++++++++++++++++++++++++++--
tests/test-parse-datetime.c | 61 ++++++++++++++++++++++++++++++++++++++
3 files changed, 135 insertions(+), 3 deletions(-)
diff --git a/doc/parse-datetime.texi b/doc/parse-datetime.texi
index 6b3e973..9aa87ed 100644
--- a/doc/parse-datetime.texi
+++ b/doc/parse-datetime.texi
@@ -327,7 +327,12 @@ The ISO 8601 date and time of day extended format consists of an ISO
day. This format is also recognized if the @samp{T} is replaced by a
space.
-In this format, the time of day should use 24-hour notation.
+The ISO 8601 basic format is also recognized. It is identical to the ISO 8601
+extended format, except for omitting the @samp{-} separator in the date and the
+@samp{:} separator in the time. Only the HHMMSS format is supported for the
+time of day, the reduced accuracy HHMM and HH formats are not supported.
+
+In these formats, the time of day should use 24-hour notation.
Fractional seconds are allowed, with either comma or period preceding
the fraction. ISO 8601 fractional minutes and hours are not
supported. Typically, hosts support nanosecond timestamp resolution;
@@ -339,6 +344,8 @@ Here are some examples:
2012-09-24T20:02:00.052-0500
2012-12-31T23:59:59,999999999+1100
1970-01-01 00:00Z
+20120924T200200.052-0500
+20121231T235959,999999999+1100
@end example
@node Day of week items
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 4dce7fa..fa9719d 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -257,6 +257,38 @@ digits_to_date_time (parser_control *pc, textint text_int)
}
}
+/* Extract into *PC the date info from a string of digits in ISO 8601 basic
+ format, i.e., YYYYMMHH, YYYY, or YY meaning century. Note that YYYYMM is not
+ allowed to avoid confusion with YYMMHH */
+static void
+digits_iso_8601_basic_to_date (parser_control *pc, textint text_int)
+{
+ switch (text_int.digits)
+ {
+ case 8:
+ pc->day = text_int.value % 100;
+ pc->month = (text_int.value / 100) % 100;
+ pc->year.value = text_int.value / 10000;
+ pc->year.digits = 4;
+ return;
+ case 4:
+ pc->day = 1;
+ pc->month = 1;
+ pc->year.value = text_int.value;
+ pc->year.digits = 4;
+ return;
+ case 2:
+ pc->day = 1;
+ pc->month = 1;
+ pc->year.value = text_int.value * 100;
+ pc->year.digits = 4;
+ return;
+ default:
+ pc->dates_seen++;
+ return;
+ }
+}
+
/* Increment PC->rel by FACTOR * REL (FACTOR is 1 or -1). */
static void
apply_relative_time (parser_control *pc, relative_time rel, int factor)
@@ -282,6 +314,28 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
pc->seconds.tv_nsec = nsec;
}
+/* Set PC-> hour, minutes, seconds and nanoseconds members from ISO 8601 basic
+ time. */
+static void
+set_hhmmss_iso_8601_basic_time (parser_control *pc, time_t integer_part,
+ long int fractional_part)
+{
+ if (integer_part / 1000000 > 0)
+ {
+ /* Not ISO 8601 time, arrange to reject it by incrementing
+ pc->times_seen.*/
+ pc->times_seen++;
+ }
+ else
+ {
+ /* FIXME support reduced accuracy times, i.e. HHMM and HH */
+ pc->hour = integer_part / 10000;
+ pc->minutes = (integer_part % 10000) / 100;
+ pc->seconds.tv_sec = integer_part % 100;
+ pc->seconds.tv_nsec = fractional_part;
+ }
+}
+
%}
/* We want a reentrant parser, even if the TZ manipulation and the calls to
@@ -290,8 +344,8 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
%parse-param { parser_control *pc }
%lex-param { parser_control *pc }
-/* This grammar has 31 shift/reduce conflicts. */
-%expect 31
+/* This grammar has 33 shift/reduce conflicts. */
+%expect 33
%union
{
@@ -358,12 +412,22 @@ item:
datetime:
iso_8601_datetime
+ | iso_8601_basic_datetime
;
iso_8601_datetime:
iso_8601_date 'T' iso_8601_time
;
+iso_8601_basic_datetime:
+ tUNUMBER 'T' unsigned_seconds o_zone_offset
+ {
+ digits_iso_8601_basic_to_date (pc, $1);
+ set_hhmmss_iso_8601_basic_time (pc, $3.tv_sec, $3.tv_nsec);
+ pc->meridian = MER24;
+ }
+ ;
+
time:
tUNUMBER tMERIDIAN
{
diff --git a/tests/test-parse-datetime.c b/tests/test-parse-datetime.c
index 7eba9ad..c620009 100644
--- a/tests/test-parse-datetime.c
+++ b/tests/test-parse-datetime.c
@@ -216,6 +216,67 @@ main (int argc _GL_UNUSED, char **argv)
&& expected.tv_nsec == result.tv_nsec);
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, local time zone */
+ p = "20110501T115518";
+ expected.tv_sec = ref_time - gmtoff;
+ expected.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, UTC */
+ p = "20110501T115518Z";
+ expected.tv_sec = ref_time;
+ expected.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, w/UTC offset */
+ p = "20110501T115518-0700";
+ expected.tv_sec = 1304276118;
+ expected.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, w/hour only UTC offset */
+ p = "20110501T115518-07";
+ expected.tv_sec = 1304276118;
+ expected.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, w/hour only UTC offset, with ns */
+ p = "20110501T115518,123456789-07";
+ expected.tv_sec = 1304276118;
+ expected.tv_nsec = 123456789;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* Invalid ISO 8601 basic date and time of day representation,
+ too many digits for time */
+ p = "20110501T11551800";
+ ASSERT (!parse_datetime (&result, p, 0));
+
+
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "now";
--
1.7.9.5
bug-coreutils@HIDDEN:bug#14097; Package coreutils.
Full text available.
Received: (at submit) by debbugs.gnu.org; 24 Apr 2013 22:07:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 24 18:07:40 2013
Received: from localhost ([127.0.0.1]:41694 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1UV7ql-0005pd-Tn
for submit <at> debbugs.gnu.org; Wed, 24 Apr 2013 18:07:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59330)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from <eggert@HIDDEN>) id 1UV7qj-0005pW-Cg
for submit <at> debbugs.gnu.org; Wed, 24 Apr 2013 18:07:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <eggert@HIDDEN>) id 1UV7lm-0007Sm-SS
for submit <at> debbugs.gnu.org; Wed, 24 Apr 2013 18:02:32 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-102.3 required=5.0 tests=BAYES_20, RCVD_IN_DNSWL_MED,
RP_MATCHES_RCVD,USER_IN_WHITELIST autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:51272)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <eggert@HIDDEN>) id 1UV7lm-0007Se-Pn
for submit <at> debbugs.gnu.org; Wed, 24 Apr 2013 18:02:30 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42427)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from <eggert@HIDDEN>) id 1UV7ll-0002fz-Jm
for bug-coreutils@HIDDEN; Wed, 24 Apr 2013 18:02:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <eggert@HIDDEN>) id 1UV7lk-0007Ri-27
for bug-coreutils@HIDDEN; Wed, 24 Apr 2013 18:02:29 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62]:56871)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <eggert@HIDDEN>)
id 1UV7lj-0007RI-SG; Wed, 24 Apr 2013 18:02:27 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp.cs.ucla.edu (Postfix) with ESMTP id 5862139E8106;
Wed, 24 Apr 2013 15:02:26 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id tT7XXU6WO4VF; Wed, 24 Apr 2013 15:02:25 -0700 (PDT)
Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200])
by smtp.cs.ucla.edu (Postfix) with ESMTPSA id E862939E8008;
Wed, 24 Apr 2013 15:02:25 -0700 (PDT)
Message-ID: <51785671.1080300@HIDDEN>
Date: Wed, 24 Apr 2013 15:02:25 -0700
From: Paul Eggert <eggert@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:17.0) Gecko/20130311 Thunderbird/17.0.4
MIME-Version: 1.0
To: =?UTF-8?B?TWloYWkgQ2Fwb3TEgw==?= <mihai@HIDDEN>
Subject: Re: [PATCH] Add support for ISO 8601 basic format
References: <1364671093-32496-1-git-send-email-mihai@HIDDEN>
In-Reply-To: <1364671093-32496-1-git-send-email-mihai@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils@HIDDEN, bug-gnulib@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.2 (------)
Thanks for taking this on. Here is a brief review.
The most important thing is that the patch also needs
to update doc/parse-datetime.texi. Also, some comments
about the code changes:
On 03/30/13 12:18, Mihai Capot=C4=83 wrote:
> + /* not ISO 8601 time, forcing mktime error */
> + pc->hour =3D 90;
How does this force a mktime error? mktime allows tm_hour =3D=3D 90.
> datetime:
> iso_8601_datetime
> + | iso_8601_basic_datetime
> ;
> =20
> iso_8601_datetime:
> iso_8601_date 'T' iso_8601_time
> ;
> =20
> +iso_8601_basic_datetime:
> + number 'T' iso_8601_basic_time
> + { pc->dates_seen--; } /* already incremented in digits_to_date_t=
ime */
This doesn't look right. 'number' accepts all sort of things that we
would rather not accept here. Conversely, why require ":" in times to
correlate with "-" in dates? Shouldn't we accept a "-"less date along
with a ":"ful time, and vice versa? And that "dates_seen--" business
is a hack; can't we arrange things so that dates_seen is incremented
just once?
> +iso_8601_basic_time:
> + tUNUMBER o_zone_offset
> + {
> + set_hhmmss_iso_8601_basic_time (pc, $1.value, 0);
> + pc->meridian =3D MER24;
> + }
> + | tUDECIMAL_NUMBER o_zone_offset
> + {
> + /* FIXME avoid time_t to long int cast */
Why is the cast needed? Also, can't the grammar be simplified
here, by using unsigned_seconds instead of using both
tUDECIMAL_NUMBER and tUNUMBER?
bug-coreutils@HIDDEN:bug#14097; Package coreutils.
Full text available.Received: (at 14097) by debbugs.gnu.org; 24 Apr 2013 12:10:55 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 24 08:10:55 2013 Received: from localhost ([127.0.0.1]:40537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UUyXG-00026O-D4 for submit <at> debbugs.gnu.org; Wed, 24 Apr 2013 08:10:54 -0400 Received: from mail-ia0-f176.google.com ([209.85.210.176]:55583) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <mihai@HIDDEN>) id 1UUyXD-000263-MN for 14097 <at> debbugs.gnu.org; Wed, 24 Apr 2013 08:10:52 -0400 Received: by mail-ia0-f176.google.com with SMTP id l27so1043936iae.21 for <14097 <at> debbugs.gnu.org>; Wed, 24 Apr 2013 05:05:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=4EXvKTFprsMMZL1wBdFgoPmJTUrdDhDnckQKIQLM8tE=; b=di/fVzHqtLHS2LUXfw2k5Sp0eDp3ttZiYQ041w4lXY2joERBvF/D5/gZvn3YbU90qU mY96i4YolhI7WfsejQrCgO2SzsQJ9LgQYpIGdvM0yFX2LAeLoVlqgVTbByNQ5QGAC5lV lIImlGL0lLvY06LhTcrvKhqyDjM8o+XN6O4EOdi2ja0stivwe6/0W2RUdXj5+OUt9C0X KHgl7Yx2mKOgSBvRxsdWfJNccLM7++2zk/5eHlsUsQZKdYxY6srFYs8QcVsaJfKlJYs0 r6pNnxbB67tQXNkm8vYx4ZQA/nl4oejfWsugXYq+/+vNzbysymF1Der3yy7VuZAPIHXI yGQw== MIME-Version: 1.0 X-Received: by 10.50.45.97 with SMTP id l1mr27035593igm.99.1366805149151; Wed, 24 Apr 2013 05:05:49 -0700 (PDT) Received: by 10.64.28.229 with HTTP; Wed, 24 Apr 2013 05:05:49 -0700 (PDT) In-Reply-To: <515982C3.6000403@HIDDEN> References: <1364671093-32496-1-git-send-email-mihai@HIDDEN> <515982C3.6000403@HIDDEN> Date: Wed, 24 Apr 2013 14:05:49 +0200 Message-ID: <CADyhzG0TeCWCvZ7cvN6nKD1xMHMzFF1Q+jSSnEaitEZft+1pBA@HIDDEN> Subject: Re: bug#14097: [PATCH] Add support for ISO 8601 basic format From: =?UTF-8?Q?Mihai_Capot=C4=83?= <mihai@HIDDEN> To: Eric Blake <eblake@HIDDEN> Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlFdwJB4dvBFZKtWYZI+k0VIofIO+fKNwzO1rdk5UgQAFsJ4IuijZ4l4X4QBkFQb5cMeuXa X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 14097 Cc: 14097 <at> debbugs.gnu.org, bug-gnulib@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.6 (--) On Mon, Apr 1, 2013 at 2:51 PM, Eric Blake <eblake@HIDDEN> wrote: > This patch is non-trivial in size. I stopped reviewing here; we would > need to have copyright assignment on file to take this patch from you. > Is this still something you are interested in pursuing? I completed the assignment process. Please continue the review. Mihai
bug-coreutils@HIDDEN:bug#14097; Package coreutils.
Full text available.Received: (at 14097) by debbugs.gnu.org; 1 Apr 2013 13:19:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 01 09:19:29 2013 Received: from localhost ([127.0.0.1]:55689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UMee1-0003cL-44 for submit <at> debbugs.gnu.org; Mon, 01 Apr 2013 09:19:29 -0400 Received: from mail-ia0-f179.google.com ([209.85.210.179]:47518) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <mihai@HIDDEN>) id 1UMedz-0003cD-5q for 14097 <at> debbugs.gnu.org; Mon, 01 Apr 2013 09:19:28 -0400 Received: by mail-ia0-f179.google.com with SMTP id x24so1872882iak.10 for <14097 <at> debbugs.gnu.org>; Mon, 01 Apr 2013 06:16:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=m7XPZ+jjok1nRRQ7AiLe/JvriWuivQiUZ2IA5TjbL0I=; b=mc3R1OVPJVC52KlQvBrw06OlvRqCPdbDS/zKg9xp4/hKoR+FaasR+zKb42h5tQE50x uy+kN4Ra0xzE91D7I9o38MWAuCSe0qrMDy9MEwT1g1TFKypVfBP6BkHZ79x3yQDm+gyI TS3vdn0ZJSf8bRJj/dfHMHWOhgmRdmyMTtXXrufEpw5BKUDkeaaLvxlHG9oOYTuncFgT AymxF40XcsBtrfWycDUM7nhJmflKjO0MIUYZ98xY25TXT7aEssQIzk4MocdPNKfaeEj+ Y0bwZvG+NFHD9eM4NSZAeotlD3MxCqeppd4C6E62HvjG85ie1qkdOHwbekgdU4IE7K8u Z+dQ== MIME-Version: 1.0 X-Received: by 10.50.196.165 with SMTP id in5mr3323419igc.99.1364822193785; Mon, 01 Apr 2013 06:16:33 -0700 (PDT) Received: by 10.64.7.75 with HTTP; Mon, 1 Apr 2013 06:16:33 -0700 (PDT) In-Reply-To: <515982C3.6000403@HIDDEN> References: <1364671093-32496-1-git-send-email-mihai@HIDDEN> <515982C3.6000403@HIDDEN> Date: Mon, 1 Apr 2013 15:16:33 +0200 Message-ID: <CADyhzG1WOQKcO2uUmgzraUDMRJvcU92qHF=c3fosLfe9=wgB8A@HIDDEN> Subject: Re: bug#14097: [PATCH] Add support for ISO 8601 basic format From: =?UTF-8?Q?Mihai_Capot=C4=83?= <mihai@HIDDEN> To: Eric Blake <eblake@HIDDEN> Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlz1dr9ko2ckQhS1F6uSFGfZlhiUpZRBPBxo2LrSVJfbI1suOOupRYQF7enKb7Uxp0r2kJn X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 14097 Cc: 14097 <at> debbugs.gnu.org, bug-gnulib@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.6 (--) On Mon, Apr 1, 2013 at 2:51 PM, Eric Blake <eblake@HIDDEN> wrote: > This patch is non-trivial in size. I stopped reviewing here; we would > need to have copyright assignment on file to take this patch from you. > Is this still something you are interested in pursuing? Yes, it is. I will take care of the copyright assignment ASAP. Mihai
bug-coreutils@HIDDEN:bug#14097; Package coreutils.
Full text available.Received: (at 14097) by debbugs.gnu.org; 1 Apr 2013 12:54:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 01 08:54:16 2013 Received: from localhost ([127.0.0.1]:55670 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UMeFb-00031S-Eu for submit <at> debbugs.gnu.org; Mon, 01 Apr 2013 08:54:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2834) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <eblake@HIDDEN>) id 1UMeFX-00031H-8P for 14097 <at> debbugs.gnu.org; Mon, 01 Apr 2013 08:54:13 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r31CpHE5023788 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 1 Apr 2013 08:51:17 -0400 Received: from [10.3.113.179] (ovpn-113-179.phx2.redhat.com [10.3.113.179]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r31CpG7r001836; Mon, 1 Apr 2013 08:51:16 -0400 Message-ID: <515982C3.6000403@HIDDEN> Date: Mon, 01 Apr 2013 06:51:15 -0600 From: Eric Blake <eblake@HIDDEN> Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: =?UTF-8?B?TWloYWkgQ2Fwb3TEgw==?= <mihai@HIDDEN> Subject: Re: bug#14097: [PATCH] Add support for ISO 8601 basic format References: <1364671093-32496-1-git-send-email-mihai@HIDDEN> In-Reply-To: <1364671093-32496-1-git-send-email-mihai@HIDDEN> X-Enigmail-Version: 1.5.1 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2ONEBXNICVMWFVUXEDIPM" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -7.3 (-------) X-Debbugs-Envelope-To: 14097 Cc: 14097 <at> debbugs.gnu.org, bug-gnulib@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -9.2 (---------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2ONEBXNICVMWFVUXEDIPM Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/30/2013 01:18 PM, Mihai Capot=C4=83 wrote: > The parser now accepts the basic format for combined date and time > representations, which ommits the date and time separators, "-" and ":"= =2E s/ommits/omits/ >=20 > See bug 23767 for GNU coreutils, <https://savannah.gnu.org/bugs/?23767>= =2E >=20 > * lib/parse-datetime.y: Parse combined date and time representations in= > ISO 8601 basic format. > (set_hhmmss_iso_8601_basic_time) New function. > * tests/test-parse-datetime.c: Add new tests for combined date and time= > representations in ISO 8601 basic format. > --- > lib/parse-datetime.y | 78 +++++++++++++++++++++++++++++++++++= ++++++-- > tests/test-parse-datetime.c | 61 +++++++++++++++++++++++++++++++++ This patch is non-trivial in size. I stopped reviewing here; we would need to have copyright assignment on file to take this patch from you. Is this still something you are interested in pursuing? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2ONEBXNICVMWFVUXEDIPM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRWYLEAAoJEKeha0olJ0NqefcH/iFXAJnEwrisZXSCfyz+A5Jh nZkWiZOZ6hMpk0i4qH3gn5p39gFI6pOkV8KwIUKWmbDT7eAj4XVE7mwyQGNnccPk PdXrLXgo/SAqKFbRp6hnudMmpzlrlKaQIgA06nMB4b3pkI0xxq6iUcSzIhgL+q7Z wy2ojK5/0z7Anxzfdkfz0EIhha8nEA86JP2JOzya4hRoHmagUOe878n5If1cTt9G 7KEsSDdWVEfayjPwY+XJWe5FhFRd8Ehtf9Qjpel+5ggYti9RB0vP5MNAcxL8oYaT rvZ4nt2vidZb9Rz6EcArqSponPQwqO0hIEGROXtiei1x74YcnqgLoRJJgPTOsU4= =RuYV -----END PGP SIGNATURE----- ------enig2ONEBXNICVMWFVUXEDIPM--
bug-coreutils@HIDDEN:bug#14097; Package coreutils.
Full text available.
Received: (at submit) by debbugs.gnu.org; 30 Mar 2013 19:21:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 30 15:21:32 2013
Received: from localhost ([127.0.0.1]:53078 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1UM1LH-0001N0-W8
for submit <at> debbugs.gnu.org; Sat, 30 Mar 2013 15:21:32 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39897)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from <mihai@HIDDEN>) id 1UM1LE-0001Mq-4q
for submit <at> debbugs.gnu.org; Sat, 30 Mar 2013 15:21:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <mihai@HIDDEN>) id 1UM1IX-0003dA-Ff
for submit <at> debbugs.gnu.org; Sat, 30 Mar 2013 15:18:44 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, USER_IN_WHITELIST
autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:41355)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <mihai@HIDDEN>) id 1UM1IX-0003d6-Ca
for submit <at> debbugs.gnu.org; Sat, 30 Mar 2013 15:18:41 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51248)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from <mihai@HIDDEN>) id 1UM1IT-0006IL-Hb
for bug-coreutils@HIDDEN; Sat, 30 Mar 2013 15:18:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <mihai@HIDDEN>) id 1UM1IQ-0003cW-6d
for bug-coreutils@HIDDEN; Sat, 30 Mar 2013 15:18:37 -0400
Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:45126)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <mihai@HIDDEN>) id 1UM1IP-0003cC-T9
for bug-coreutils@HIDDEN; Sat, 30 Mar 2013 15:18:34 -0400
Received: by mail-wi0-f182.google.com with SMTP id hi18so652837wib.9
for <bug-coreutils@HIDDEN>; Sat, 30 Mar 2013 12:18:32 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20120113;
h=x-received:from:to:cc:subject:date:message-id:x-mailer
:x-gm-message-state;
bh=1cWS3oeOHgScddIXcPlxsqS4FSuxZa/FwjlJaaABP/M=;
b=d/Jv3zBXgTCWzj0+7PCl/J4sQD3vHsMht1oL+NlS0Wbj9Zr3GAmo4y0mlRhReQdXPi
Vv0D/CYEpfgfnJcCiud1lo5h4fa3kDZ7dFr1dDjgr6nS703rKflG3g8yuQVZQZEts28a
oGnciLPQe0Ri3QpXtGZ1Jh23+6aD/mHq9Qg2eIgyhEmvFZUP9Qr7PzF4XeDMexClrOjr
79liRwFir03P5rpjgE7nD0ucoM8Lyg+6UmH50c7gFkbbr3XBaDxTWtKPiMAfzjkAUWut
XeIa0gGsVwnTT9MB5dqRt3h0+zgh3+4Fknm0goczpPlNBDSZprixI6Y29IVRMfS3H4ZT
+QLA==
X-Received: by 10.180.77.9 with SMTP id o9mr3523637wiw.16.1364671112406;
Sat, 30 Mar 2013 12:18:32 -0700 (PDT)
Received: from dutier.st.ewi.tudelft.nl (dutier.st.ewi.tudelft.nl.
[130.161.159.51])
by mx.google.com with ESMTPS id bq19sm5355340wib.7.2013.03.30.12.18.30
(version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
Sat, 30 Mar 2013 12:18:31 -0700 (PDT)
From: =?UTF-8?q?Mihai=20Capot=C4=83?= <mihai@HIDDEN>
To: bug-gnulib@HIDDEN
Subject: [PATCH] Add support for ISO 8601 basic format
Date: Sat, 30 Mar 2013 20:18:13 +0100
Message-Id: <1364671093-32496-1-git-send-email-mihai@HIDDEN>
X-Mailer: git-send-email 1.7.9.5
X-Gm-Message-State: ALoCoQmnCaim/JZs7d0G70DJ3pJmVKWIgxTI1WuPXwrKy0+yt2VWbgHB/2nfLej+oK1LeweoT2RU
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
(bad octet value).
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -6.2 (------)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.2 (------)
The parser now accepts the basic format for combined date and time
representations, which ommits the date and time separators, "-" and ":".
See bug 23767 for GNU coreutils, <https://savannah.gnu.org/bugs/?23767>.
* lib/parse-datetime.y: Parse combined date and time representations in
ISO 8601 basic format.
(set_hhmmss_iso_8601_basic_time) New function.
* tests/test-parse-datetime.c: Add new tests for combined date and time
representations in ISO 8601 basic format.
---
lib/parse-datetime.y | 78 +++++++++++++++++++++++++++++++++++++++++--
tests/test-parse-datetime.c | 61 +++++++++++++++++++++++++++++++++
2 files changed, 137 insertions(+), 2 deletions(-)
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 77d95b7..20bf1ac 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -282,6 +282,60 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
pc->seconds.tv_nsec = nsec;
}
+/* Set PC-> hour, minutes, seconds and nanoseconds members from ISO 8601 basic
+ time. */
+static void
+set_hhmmss_iso_8601_basic_time (parser_control *pc, long int integer_part,
+ long int fractional_part)
+{
+ if (integer_part / 1000000 > 0)
+ {
+ /* not ISO 8601 time, forcing mktime error */
+ pc->hour = 90;
+ pc->minutes = 0;
+ pc->seconds.tv_sec = 0;
+ pc->seconds.tv_nsec = 0;
+ }
+ else
+ {
+ pc->hour = integer_part / 10000;
+ if (pc->hour > 0) /* HHMMSS */
+ {
+ pc->minutes = (integer_part % 10000) / 100;
+ pc->seconds.tv_sec = integer_part % 100;
+ pc->seconds.tv_nsec = fractional_part;
+ }
+ else
+ {
+ if (fractional_part != 0)
+ {
+ /* FIXME support fractional part for minutes and hours */
+ pc->hour = 90;
+ pc->minutes = 0;
+ pc->seconds.tv_sec = 0;
+ pc->seconds.tv_nsec = 0;
+ }
+ else
+ {
+ pc->hour = integer_part / 100;
+ if (pc->hour > 0) /* HHMM */
+ {
+ pc->minutes = integer_part % 100;
+ pc->seconds.tv_sec = 0;
+ pc->seconds.tv_nsec = 0;
+ }
+ else /* HH */
+ {
+ pc->hour = integer_part;
+ pc->minutes = 0;
+ pc->seconds.tv_sec = 0;
+ pc->seconds.tv_nsec = 0;
+ }
+ }
+ }
+ }
+}
+
%}
/* We want a reentrant parser, even if the TZ manipulation and the calls to
@@ -290,8 +344,8 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
%parse-param { parser_control *pc }
%lex-param { parser_control *pc }
-/* This grammar has 31 shift/reduce conflicts. */
-%expect 31
+/* This grammar has 34 shift/reduce conflicts. */
+%expect 34
%union
{
@@ -358,12 +412,18 @@ item:
datetime:
iso_8601_datetime
+ | iso_8601_basic_datetime
;
iso_8601_datetime:
iso_8601_date 'T' iso_8601_time
;
+iso_8601_basic_datetime:
+ number 'T' iso_8601_basic_time
+ { pc->dates_seen--; } /* already incremented in digits_to_date_time */
+ ;
+
time:
tUNUMBER tMERIDIAN
{
@@ -401,6 +461,20 @@ iso_8601_time:
}
;
+iso_8601_basic_time:
+ tUNUMBER o_zone_offset
+ {
+ set_hhmmss_iso_8601_basic_time (pc, $1.value, 0);
+ pc->meridian = MER24;
+ }
+ | tUDECIMAL_NUMBER o_zone_offset
+ {
+ /* FIXME avoid time_t to long int cast */
+ set_hhmmss_iso_8601_basic_time (pc, (long int)$1.tv_sec, $1.tv_nsec);
+ pc->meridian = MER24;
+ }
+ ;
+
o_zone_offset:
/* empty */
| zone_offset
diff --git a/tests/test-parse-datetime.c b/tests/test-parse-datetime.c
index 7eba9ad..c620009 100644
--- a/tests/test-parse-datetime.c
+++ b/tests/test-parse-datetime.c
@@ -216,6 +216,67 @@ main (int argc _GL_UNUSED, char **argv)
&& expected.tv_nsec == result.tv_nsec);
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, local time zone */
+ p = "20110501T115518";
+ expected.tv_sec = ref_time - gmtoff;
+ expected.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, UTC */
+ p = "20110501T115518Z";
+ expected.tv_sec = ref_time;
+ expected.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, w/UTC offset */
+ p = "20110501T115518-0700";
+ expected.tv_sec = 1304276118;
+ expected.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, w/hour only UTC offset */
+ p = "20110501T115518-07";
+ expected.tv_sec = 1304276118;
+ expected.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* ISO 8601 basic date and time of day representation,
+ 'T' separator, w/hour only UTC offset, with ns */
+ p = "20110501T115518,123456789-07";
+ expected.tv_sec = 1304276118;
+ expected.tv_nsec = 123456789;
+ ASSERT (parse_datetime (&result, p, 0));
+ LOG (p, expected, result);
+ ASSERT (expected.tv_sec == result.tv_sec
+ && expected.tv_nsec == result.tv_nsec);
+
+
+ /* Invalid ISO 8601 basic date and time of day representation,
+ too many digits for time */
+ p = "20110501T11551800";
+ ASSERT (!parse_datetime (&result, p, 0));
+
+
now.tv_sec = 4711;
now.tv_nsec = 1267;
p = "now";
--
1.7.9.5
Mihai Capotă <mihai@HIDDEN>:bug-coreutils@HIDDEN.
Full text available.bug-coreutils@HIDDEN:bug#14097; Package coreutils.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.