Re: [notmuch] [PATCH] Make the date parser nicer

Subject: Re: [notmuch] [PATCH] Make the date parser nicer

Date: Fri, 22 Jan 2010 17:04:29 +0100

To: notmuch@notmuchmail.org

Cc:

From: Sebastian Spaeth


On Fri, 22 Jan 2010 16:26:11 +0100, Sebastian Spaeth <Sebastian@SSpaeth.de> wrot> +	if (begin.size() == 8) {
> +	  int no_items;
> +	  no_items = sscanf(begin.c_str(), "%4i%2i%2i", &year, &month, &day);
> +	  if (no_items != 3)
> +	    return Xapian::BAD_VALUENO;

Also I have found that my sscanf skills are sourly lacking:
a date of 20060108 will lead to 2006 1 0 for (year, month, day)

I bet someone knows a nice way to parse those values in a good way.

Sebastian

Thread: