|
putenv("TZ=Europe/London"); // time zone of the place you want to predict tides for
$last_synchronised_with_the_high_tide = '4 Sep 2008 1:36am'; // tide from which all calcs are made - reset occasionally
$icon_diameter=45; // clock diameter in pixels
$stroke_thickness=3; // the thickness of the lines used to draw the clock
// nothing below here should need changing
$now=time();
if (($timestamp = strtotime($last_synchronised_with_the_high_tide)) === -1)
{echo "the string ($last_synchronised_with_the_high_tide) does not return a valid date and time ";} $tide_cycle_in_seconds=44700; $seconds_since_last_synchronised=(time()-$timestamp); if ($seconds_since_last_synchronised > $tide_cycle_in_seconds) {$seconds_since_last_high_tide= $seconds_since_last_synchronised % $tide_cycle_in_seconds;} else {$seconds_since_last_high_tide=$seconds_since_last_synchronised;} $required_rotation_from_12oclock_position=($seconds_since_last_high_tide/$tide_cycle_in_seconds)*360; $vml_degrees=$required_rotation_from_12oclock_position-90; if ($vml_degrees<0) {$vml_degrees=$vml_degrees+360;} $rotation_modified_for_vml=deg2rad($vml_degrees); // calculate co-ordinates ------------------------------ $hypotenuse=($icon_diameter/3); // clock hand length $x=(cos($rotation_modified_for_vml))*$hypotenuse; $y=(sin($rotation_modified_for_vml))*$hypotenuse; print " |
|---|