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 042A6431FB6 for ; Thu, 4 Oct 2012 04:02:37 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled 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 XENmEFL1s2C1 for ; Thu, 4 Oct 2012 04:02:36 -0700 (PDT) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 63D88431FAE for ; Thu, 4 Oct 2012 04:02:36 -0700 (PDT) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 3A26019F3353; Thu, 4 Oct 2012 13:02:35 +0200 (CEST) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id TGOyvJK8Uy28; Thu, 4 Oct 2012 13:02:30 +0200 (CEST) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id 608EB19F335E; Thu, 4 Oct 2012 13:02:29 +0200 (CEST) Received: from steelpick.2x.cz (rtime.felk.cvut.cz [147.32.86.92]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id DAFC4660969; Thu, 4 Oct 2012 13:02:28 +0200 (CEST) Received: from wsh by steelpick.2x.cz with local (Exim 4.80) (envelope-from ) id 1TJjCG-0004BK-Cf; Thu, 04 Oct 2012 13:02:28 +0200 From: Michal Sojka To: Jani Nikula , notmuch@notmuchmail.org, David Bremner Subject: Re: [PATCH] test: Improve tests for the date/time parser module In-Reply-To: <87lifn47qn.fsf@nikula.org> References: <24186aafbdcb967b8f66c2390c928f3788ab6cbf.1347484177.git.jani@nikula.org> <87zk4e1f5k.fsf@steelpick.2x.cz> <87lifn47qn.fsf@nikula.org> User-Agent: Notmuch/0.14+23~g9d68aca (http://notmuchmail.org) Emacs/24.2.1 (x86_64-pc-linux-gnu) Date: Thu, 04 Oct 2012 13:02:28 +0200 Message-ID: <87obkifqkb.fsf@steelpick.2x.cz> MIME-Version: 1.0 Content-Type: text/plain 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: Thu, 04 Oct 2012 11:02:37 -0000 On Wed, Oct 03 2012, Jani Nikula wrote: > On Tue, 25 Sep 2012, Michal Sojka wrote: >> This patch reworks date/time parser library test program to make it >> easier to to write the actual tests. It also modifies the notmuch test >> script and adds several new tests to it. > [...] >> case 'n': >> - /* specify now in seconds since epoch */ >> - now = (time_t) strtol (optarg, NULL, 10); >> + memset (&tm, 0, sizeof (tm)); >> + char *parsed = strptime (optarg, format, &tm); > > One of the problems with strptime is that it doesn't support time zones, > which is why I chose not to use it here. (You can specify %z in the > format to ignore it, but it looks like it's ignored no matter > what. *shrug*) Combined with mktime below, you introduce possible TZ and > DST variations in the tests, which can be problematic. So perhaps we > should keep the reference time as a timestamp here. I didn't pay much attention to time zone issues when writing this little program, so you might be true. But note that test-lib.sh sets TZ=UTC and I hope that this should eliminate the problems. I think that it is better to have human understandable values in test scripts. -Michal