[jonah] Re: Sun Rise / Set Problem

Ruben van der Steenhoven ruben_donotspamme at webmeesters.nl
Wed Apr 16 01:42:17 PDT 2003


I am using PHP 4.3.0-dev and Zend 1.3.0 too...
You finally set me on the right track though! I got it working now!
When examining your suggestion i found that the behaviour of my PHP 
engine was not what is should be:
Lets start off with your example:

	$returnVal = $hour . ':' . $min . ':' . $sec . ':' . $mon . ':' . $mday 
. ':' . $year;
	return $returnVal;

Would yield me empty strings, but when done this way:

         $retVal = '[';
         $retval .= $hour . ':';
         $retval .= $min . ':';
         $retval .= $sec . ':';
         $retval .= $mon . ':';
         $retval .= $mday . ':';
         $retval .= $year . ']';

         return $retval;

It would yield [0:0:4:15:2003] and [0:0:4:15:2003] (notice the absence 
of the hour value here...

another example:

       return "[${hour}:${min}:${sec}:${mon}:${mday}:${year}]";

would yield [12:0:0:4:15:2003] and [0:0:0:4:15:2003] respectively.

My thought was that such differences in simple string-catenation cannot 
be  normal behaviour, so i downloaded the newest stable release of PHP 
(4.3.1) and compiled and installed it and now it works!

Thanks a million for your help and patience! If i can return any favour, 
please lemme know!

Jeff Graves wrote:
> I'm guessing it's something to do with this function on your system:
> 
> return strftime('%X', mktime($hour, $min, $sec, $mon, $mday, $year));
> 
> I'm using PHP 4.3.0 Zend engine 1.3.0 and I just tried the Volkel
> Airport and it returned:
> 
> Date: 1050427779
> YDay: 104 Mon: 4 MDay: 15 Year: 2003 DST: 1 TZ: -4
> Lat: 51.650 Long: 5.700
> 
> 00:44:18
> 14:31:50
> 
> Check it by modifying the return at the end to return the values of
> the variables instead of passing them to mktime:
> 
> +>	$returnVal = $hour . ':' . $min . ':' . $sec . ':' . $mon . ':' .
> $mday . ':' . $year;
> 
>         //return strftime('%X', mktime($hour, $min, $sec, $mon, $mday,
> $year));
> +>	return $returnVal;
> 
> See what you get. If you get something other than 12:00:00 and
> 00:00:00 then the problem is in the return statement. If you still get
> those bogus values, then something's wrong in the calculation.
> 
> Jeff Graves
> Customer Support Engineer
> Image Source, Inc.
> 10 Mill Street
> Bellingham, MA 02019
> 
> jeff at image-src.com - Email
> 508.966.5200 X31 - Phone
> 508.966.5170 - Fax
> 
> -----Original Message-----
> From: jonah-bounces at lists.horde.org
> [mailto:jonah-bounces at lists.horde.org]On Behalf Of Ruben van der
> Steenhoven
> Sent: Tuesday, April 15, 2003 12:17 PM
> To: jonah at lists.horde.org
> Subject: [jonah] Re: Sun Rise / Set Problem
> 
> 
> Yep, when i changed over to Mexico these were the values that went
> into
> calcSunset:
> 
> Date: 1050423293
> YDay: 104 Mon: 4 MDay: 15 Year: 2003 DST: 1 TZ: 2
> Lat: 25.867 Long: -100.233
> 
> and returned:
> Rise: 12:00:00 Set: 00:00:00
> 
> the date on my server is correct as you can see, even worse, it's
> synchronised to a NTP-server...
> I am baffled, the formula in calcSunset is just a bit to steep for me
> to
> delve into quickly
> 
> Oh yes, i use exactly the same version as you do...
> 
> Jeff Graves wrote:
> 
>>I assume that when you changed locations to Mexico, the results code
>>fragment you added were different? Can you check the values returned
>>by calcSunset? It seems kind of odd that it would always return
>>12:00:00 and 00:00:00 since it's a mathimatical function (you've
>>probably already done this but is the date correct on your server?).
>>And just so we're on the same page:
>>
>>* $Horde: jonah/lib/Block/sunrise.php,v 1.6 2003/02/08 12:06:04 jan
>>Exp $
>>
>>is what I'm using.
>>
>>Jeff Graves
>>Customer Support Engineer
>>Image Source, Inc.
>>10 Mill Street
>>Bellingham, MA 02019
>>
>>jeff at image-src.com - Email
>>508.966.5200 X31 - Phone
>>508.966.5170 - Fax
>>
>>-----Original Message-----
>>From: jonah-bounces at lists.horde.org
>>[mailto:jonah-bounces at lists.horde.org]On Behalf Of Ruben van der
>>Steenhoven
>>Sent: Tuesday, April 15, 2003 10:06 AM
>>To: jonah at lists.horde.org
>>Subject: [jonah] Re: Sun Rise / Set Problem
>>
>>
>>I didn't do that in the config files. I just selected the nearest
>>airport  in the Block options of the sunset block. (This was of some
>>help, because of your question i had to retrace my steps to find out
>>that i COULD change the location without bothering other Horde
>>components after all). Now i also tried some other locations like
>>Mexico
>>and Amsterdam, but with all the same results.
>>
>>I've added following code to the _content function of
>>jonah/lib/Block/sunrise.php to find the values i mentioned: (BTW:
> 
> That
> 
>>date format you mentioned is the tandard UNIX-internal date format.)
>>
>>
> 
> 
> 
> 
> --
> Jonah mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: jonah-unsubscribe at lists.horde.org
> 
> 




More information about the jonah mailing list