[kronolith] Re: your mail

Chuck Hagenbuch chuck@horde.org
Thu, 16 Nov 2000 23:57:16 -0500


Quoting eculp@EnContacto.Net <eculp@EnContacto.Net>:

> Thanks.  Found it and cvs'ed it compiled it with results similar to Raul in
> question of the install.  In my freebsd current I had to change the include in
> libcal/mstore.c for crypt to des_crypt.

Might want to submit that to the libmcal-users list.

-chuck

--
We are not just cogs in a collective happiness machine.


>From chuck@horde.org Date: Tue,  5 Dec 2000 19:31:53 -0500
Return-Path: <chuck@horde.org>
Mailing-List: contact kronolith-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list kronolith@lists.horde.org
Received: (qmail 59751 invoked from network); 6 Dec 2000 00:32:34 -0000
Received: from r94aag005136.sbo-smr.ma.cable.rcn.com (HELO marina.horde.org) (146.115.120.202)
  by horde.org with SMTP; 6 Dec 2000 00:32:34 -0000
Received: by marina.horde.org (Postfix, from userid 33)
	id B75563D11; Tue,  5 Dec 2000 19:31:53 -0500 (EST)
Received: from 206.243.191.252 ( [206.243.191.252])
	as user chuck@marina by marina.horde.org with HTTP;
	Tue,  5 Dec 2000 19:31:53 -0500
Message-ID: <976062713.3a2d88f97fd2a@marina.horde.org>
Date: Tue,  5 Dec 2000 19:31:53 -0500
From: Chuck Hagenbuch <chuck@horde.org>
To: libmcal-devel@lists.sourceforge.net
Cc: libmcal-users@lists.sourceforge.net, kronolith@lists.horde.org
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 2.3.6-cvs
Subject: problem in dt_setdoe

In the course of playing with Kronolith (my php web calendar written using 
mcal), I noticed that no repeating events were showing up in the last week of 
December. Thinking this odd, I started digging, and (after groaning at a lot 
of "// I have no idea how this works" comments in the source) found that 
dt_setdoe has a bug: it skips the 31st of December this year.

If you pass in 730484, you get back a datetime_t with December 30th, 2000 in 
it. If you pass in 730485, you get a datetime_t with January 1st, 2001.

However, now I'm stuck, since I can't find any documentation on algorithms for 
days-since-epoch on the net, and the code in question:

	year = 400 * (doe / (400 * 365 + 97));	doe %= (400 * 365 + 97);
	year += 100 * (doe / (100 * 365 + 24));	doe %= (100 * 365 + 24);
	year += 4 * (doe / (4 * 365 + 1));      doe %= (4 * 365 + 1);
	year += (doe / 365) + 1;                doe %= 365;

... is a chunk of math that I don't even want to _try_ messing with by trial 
and error.

Btw, the circumstances under which I reproduced this problem involve using 
Monday as the start of the week (which is the ISO standard, btw), so remember 
to change that if you try and reproduce it holistically.

Also, I have a request: anyone who fixes this, please mail me the fix and let 
me commit it. In the course of tracking this down, I cleaned up a lot of random 
cruft and added some comments to the source explaining some of the more 
unintuitive bits (though there's certainly a lot left to do in that regard), 
and I'd like not to have to merge those changes in to another commit.

Finally: I asked a few weeks ago about cutting a new release of the library, 
since the last time a tarball was released was March. If no one who is 
currently a project admin on Sourceforge has the time/interest to do releases 
(preferably once this bug is fixed), would you be willing to make me a project 
admin (Mark?)? I already have dev access to the project; my Sourceforge userid 
is "chuck".

Thanks,
-chuck

--
Charles Hagenbuch, <chuck@horde.org>
"If you can't stand the heat, get out of the chicken!" - Baby Blues