From owner-freebsd-hackers Wed Oct 10 1:54: 1 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from straylight.ringlet.net (straylight.ringlet.net [217.75.134.254]) by hub.freebsd.org (Postfix) with SMTP id E0C9D37B401 for ; Wed, 10 Oct 2001 01:53:55 -0700 (PDT) Received: (qmail 1588 invoked by uid 1000); 10 Oct 2001 08:53:49 -0000 Date: Wed, 10 Oct 2001 11:53:48 +0300 From: Peter Pentchev To: Steve Ames Cc: freebsd-hackers@freebsd.org Subject: Re: calendar nit? Message-ID: <20011010115348.C620@straylight.oblivion.bg> Mail-Followup-To: Steve Ames , freebsd-hackers@freebsd.org References: <200110092059.f99Kxmd14916@virtual-voodoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200110092059.f99Kxmd14916@virtual-voodoo.com>; from steve@virtual-voodoo.com on Tue, Oct 09, 2001 at 03:59:48PM -0500 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Oct 09, 2001 at 03:59:48PM -0500, Steve Ames wrote: > > I was sending an e-mail to someone and wasn't sure what day Thanksgiving > was so I typed 'calendar -A 45' and saw the following: > > Nov 8* Thanksgiving Day (4th Thursday in November) > > Odd that... This is a little weirdness with the calendar(1) way of dealing with date specifications such as 'the Nth Wday of the month'. It calculates the date of the Wday in the week starting today, then calculates the week of the month that that date falls within. *Boggle*. There is a comparison afterwards, and if that fails, the holiday is still marked as fit to be printed, and its date is set to yesterday (around line 342 of day.c). Among other things, this is very much related to the current date, and it is of somewhat limited usability if used with the -A or -B options. Okay, it plain does not work if used with the -A or -B options. I'll try to rack my brains a bit more to see if there is a way to actually calculate the exact date that 'the Nth Wday of the month' falls upon. There seems to be a bit of a weirdness there in cases (like yours) when the current month is not the same as the month of the examined date. Hell, even the current *year* might not be the same! Okay, I'll try to think of something today, unless all of this makes my brain implode, as it is wont to do on sleepless weeks like this one.. G'luck, Peter -- Do you think anybody has ever had *precisely this thought* before? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message