<?php
$kvadrat =200;
function Arrow ($image,$Time,$Divider,$color) {
GLOBAL $kvadrat,$center;
$alpha = (360/$Divider)*$Time;
$length = ($kvadrat/2) - 45;
$alpha = deg2rad($alpha);
$x2 = $center + sin($alpha)*$length;
$y2 = $center - cos($alpha) *$length;
imageline ($image, $center, $center, $x2, $y2,$color);
}
function Digital_panel ($image){
GLOBAL $kvadrat,$center;
for($value=1; $value<=12; $value++) {
$length = ($kvadrat/2) - 20;
$alpha = (360/12)*$value;
$alpha = deg2rad($alpha);
$x2 = $center + sin($alpha)*$length;
$y2 = $center - cos($alpha)*$length;
$font = (preg_match ("/3|6|9|12/",$value))?3:1;
imagestring($image, $font,$x2-3,$y2-5, $value, 0xFFFFFF);
}
}
function Points_panel ($image){
GLOBAL $kvadrat,$center;
for($value=1; $value<=60; $value++) {
$length = ($kvadrat/2) - 33;
$alpha = (360/60)*$value;
$alpha = deg2rad($alpha);
$x2 = $center + sin($alpha)*$length;
$y2 = $center - cos($alpha)*$length;
$color = 0xc0ff00;
$plus = 1;
if (ereg("5$|10|20|25|35|40|50|55",$value)) { $color = 0xc06000;$plus = 2;}
if (ereg("15|30|45|60",$value)) {$color = 0xc00000;$plus = 3;}
imagefilledrectangle ($image, $x2, $y2, $x2+$plus, $y2+$plus,$color);
}
}
$center = ($kvadrat/2);
header("Content-type: image/png");
$image = imagecreatetruecolor($kvadrat,$kvadrat);
imagefill($image, 0, 0, 0x000000);
//час
Arrow ($image,date("g"),12,0xc00000);
//минуты
Arrow ($image,date("i"),60,0xc06000);
//секунды
Arrow ($image,date("s"),60,0xc0ff00);
Digital_panel($image);
Points_panel($image);
//вывод
imagepng($image);
imagedestroy($image);
?>
Пример работы http://www.welder.host-expert.com/hlam/time.php