Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Oct 2001 11:53:48 +0300
From:      Peter Pentchev <roam@ringlet.net>
To:        Steve Ames <steve@virtual-voodoo.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: calendar nit?
Message-ID:  <20011010115348.C620@straylight.oblivion.bg>
In-Reply-To: <200110092059.f99Kxmd14916@virtual-voodoo.com>; from steve@virtual-voodoo.com on Tue, Oct 09, 2001 at 03:59:48PM -0500
References:  <200110092059.f99Kxmd14916@virtual-voodoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011010115348.C620>