[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: RFC: date parser strawman

From: mark benedetto king <mbk_at_lowlatency.com>
Date: 2003-12-21 10:14:01 CET

On Sun, Dec 21, 2003 at 07:28:59AM +0100, Branko ??ibej wrote:
> >-time_t svn_parse_date (char *text, struct getdate_time *now);
> >+svn_boolean_t svn_parse_date (const char *text, apr_time_t now,
> >+ apr_int32_t gmtoff, apr_time_t *val);
> >
> >
> A few issues here:
>
> * We usually put output parameters first in the argument list.
> * Wouldn't it be better for this function to return an svn_error_t*?
> Even if you don't need it now, you almost certainly will once the
> date parser is extended to support more formats (and L10N).
> * The same argument suggests this function would need a pool someday.
>

Good points, will fix.

> Cound we say "valid" here instead of "legal"? People might get the
> impression that typing an incorrect date might get them sent to jail. :-)
>

You never know in this country. Will fix, anyway. :-)

> [...]
>
> >+/* Attempt to match the date-string in VALUE to provided TEMPLATE.
> >+ As each character is matched, the corresponding OPCODE is applied
> >+ using the corresponding OPERAND. The matched values are store in
> >
> >
> ^^^^^^ stored
>

Good eye.

>
> >+ RESULTS, the first COUNT integers of which are zeroed at entry.
> >+ Return TRUE iff the VALUE matches the TEMPLATE.
> >+
> >+ Template/Value matching is described above. Legal opcodes
> >+ are:
> >
> >
> legal->valid again
>
> [...]
>
> >+ if (template_match (value, /* try ISO-8601 extended */
> >+ "YYYY-MM-DD?Thh?:mm?:ss?.s?s?s?s?s?s?Z?+HH?:MM",
> >+ "AAAA AA AA? AA? AA? AA? M?M?M?M?M?M?S SAA AA",
> >+ "0000 11 22Z 33Z 44Z 55Z 6Z6Z6Z6Z6Z6Z7 788 99",
> >+ results, RESULT_COUNT)
> >
> >
> Won't this match "yyyy-mm-dd hh:mm:ssZ+hh:mm"? If I understand the
> template logic correctly, you're allowed to use both the magic "Z" UTC
> indicator and an explicit offset at the same time.

Yes. The sad thing is that I did it intentionally after misreading my
own proposal based on the ISO 8601:2000 document. Will fix, but at
first glance this will require a change to the matcher, not just the
template.

Also, I realize now that this implementation does not do any sanity
checking on the parsed values before handing them off to
apr_time_exp_gmt_get(). Will add that, too.

--ben

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Dec 21 10:14:39 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.