Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VbaS3-0001eg-Ai for pgsql-sql@arkaria.postgresql.org; Wed, 30 Oct 2013 18:25:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VbaS2-0005k4-LC for pgsql-sql@arkaria.postgresql.org; Wed, 30 Oct 2013 18:25:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VbaS1-0005jq-UK for pgsql-sql@postgresql.org; Wed, 30 Oct 2013 18:25:05 +0000 Received: from mbx.knossos.net.nz ([202.160.48.10]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VbaRw-00088E-Uu for pgsql-sql@postgresql.org; Wed, 30 Oct 2013 18:25:05 +0000 Received: from [10.1.1.3] (60-234-150-59.bitstream.orcon.net.nz [60.234.150.59]) (authenticated bits=0) by mbx.knossos.net.nz (8.14.4/8.14.4) with ESMTP id r9UIO46k025874 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 31 Oct 2013 07:24:13 +1300 Message-ID: <52714E3E.2080306@archidevsys.co.nz> Date: Thu, 31 Oct 2013 07:21:50 +1300 From: Gavin Flower Organization: ArchiDevSys User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: "Craig R. Skinner" , pgsql-sql@postgresql.org Subject: Re: Number of days in a tstzrange? References: <20131024204638.GA31094@teak.britvault.co.uk> <219E3855-325F-4B55-A23B-DA014FBDA2BF@excoventures.com> <20131029113450.GA26067@teak.britvault.co.uk> <20131030104015.GA12587@teak.britvault.co.uk> In-Reply-To: <20131030104015.GA12587@teak.britvault.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 30/10/13 23:40, Craig R. Skinner wrote: > On 2013-10-29 Tue 11:34 AM |, Craig R. Skinner wrote: >> -- if a subscription is ceased same day it's started, >> -- that day is still chargable, so bump it >> IF billable_days < 1 >> THEN >> billable_days := 1; >> END IF; >> ... >> ... >> > This is more accurate: > > -- If a subscription billing_period ends part way through a day, > IF upper(billable_item.billable_period)::time <> time 'allballs' > THEN > -- That partial day is still chargable, so bump it > billable_days := billable_days + 1; > END IF; > > > even for 1 second over??? I would expect any court of law to set a higher threshold! Cheers, Gavin -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql