Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3E16F431FBC for ; Fri, 22 Jan 2010 08:04:34 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.08 X-Spam-Level: X-Spam-Status: No, score=0.08 tagged_above=-999 required=5 tests=[AWL=0.079, BAYES_50=0.001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ETWSyN547CMr for ; Fri, 22 Jan 2010 08:04:33 -0800 (PST) Received: from homiemail-a21.g.dreamhost.com (mailbigip.dreamhost.com [208.97.132.5]) by olra.theworths.org (Postfix) with ESMTP id AEEC8431FAE for ; Fri, 22 Jan 2010 08:04:33 -0800 (PST) Received: from sspaeth.de (unknown [84.55.198.58]) by homiemail-a21.g.dreamhost.com (Postfix) with ESMTPA id D2DF4300061; Fri, 22 Jan 2010 08:04:31 -0800 (PST) Received: by sspaeth.de (sSMTP sendmail emulation); Fri, 22 Jan 2010 17:04:29 +0100 From: "Sebastian Spaeth" To: notmuch@notmuchmail.org In-Reply-To: <1264173971-11879-1-git-send-email-Sebastian@SSpaeth.de> References: <1264173971-11879-1-git-send-email-Sebastian@SSpaeth.de> Date: Fri, 22 Jan 2010 17:04:29 +0100 Message-ID: <87aaw66s8i.fsf@SSpaeth.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [notmuch] [PATCH] Make the date parser nicer X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2010 16:04:34 -0000 On Fri, 22 Jan 2010 16:26:11 +0100, Sebastian Spaeth 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