[notmuch] [PATCH] Make the date parser nicer

Sebastian Spaeth Sebastian at SSpaeth.de
Fri Jan 22 08:04:29 PST 2010


On Fri, 22 Jan 2010 16:26:11 +0100, Sebastian Spaeth <Sebastian at 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


More information about the notmuch mailing list