Tarjei Huse wrote:

> As far as I know, the calander functions have been broken or partly broken for
> quite some time. When will they be fixed (at least two bugreports).


found this in calendar.c :

...
startv= time(NULL);
stopv= DATE_MAX;

....

php_midgard_select (
...

"AND article.up=0 AND Unix_Timestamp(calstart)>=$d"
"AND 24*60*60-1+
Unix_timestamp(Date_Add(calstart, INTERVAL caldays DAY))<=$d",
..., startv, stopv)

Say today is 24 Sep 2001

When you set calstart to 24 Sep 2001 Midgard puts 2001-09-24 into 
database which means 2001-09-24 00:00:00 , but when selecting calendar 
startv is set to ie. "2001-09-24 16:34:23" (of course it's timestamp), 
so calstart will never be grater than startv when you want to start on 
24 Sep 2001.

 

Besides, assume calstart= 24, startv=25, stopv=30, caldays=5:

"AND article.up=0 [true] AND 24 >= 25 [FALSE] "
"AND (24*60*60-1 = 1)+ 24 + 5 <= 30 [TRUE]"

as a result we receive FALSE statement while it IS true, casue wher 
article should be on between 24 and 29 it shol;d show up in 25-30 time 
window.

I'd rather do this way:

"AND article.up=0 AND (Unix_Timestamp(calstart)>=$d"
"OR 24*60*60-1+
Unix_timestamp(Date_Add(calstart, INTERVAL caldays DAY))<=$d)",
..., startv, stopv)

So we get

"AND article.up=0 [true] AND (24 >= 25 [FALSE] "
"OR (24*60*60-1 = 1)+ 24 + 5 <= 30 [TRUE])"


which is


[true] AND ([false] OR [true]) = [true] AND [true} = [true] => we got 
the article !

Hope it is clear :-)

Solt



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to