Hi,
I am writing a class that will translate time from one Time Zone to another, as well as several other dandy things. I do have it working, but it will not be independant of it's location on the file system and here is why. The following few functions must work together.
function get_offset($zone){
//returns the GMT Offset in Hours from GMT
##############
Time Zones
##############
/Europe/
$gmt = +0; //GreenWitch Mean
$bst = +1; //British Summer Time
$ist = +1; //Irish Summer
/ etc..huge list of timezone GMT offsets /
return $$zone;
}
function get_cur_localtime($zone){
//this is where the problem is
//I need to refer back to the above
//function
require_once "Time.class";
$offset = time_object::get_offset($zone);
$day = gmdate("d");
$month = gmdate("m");
$year = gmdate("Y);
$hour = gmdate("H") + $offset;
$seconds = gmdate("s");
$time_array = getdate(mktime($hour, $minuts, $seconds, $month, $day, $year));
return $time_array;
}
Beside just these two functions are three more that need to get an offset, or a realative offset, as well as what time it was or will be in GMT at a given date/time stamp. If this object is not stored in the same directory as the script that calls it, it will not work because of the require_once statement. I want to avoid that problem, but am not sure what to do about fixing it.
Any advice or comments would be greatly appreciated.
Thanks,
Alfred