$default = " "x1924;

$PIBY30=.10486;

for(0..666){
   plotchar(24,46,$_,\$default)
}

for(27,91,59,72){
   substr($default,$n++,1)=chr$_
}

$default.=chr(10);

#while(){
   $buffer=$default;
   @t=localtime;
   my ($sec,$min,$hour, @crap) = @t;
   drawhand(20,59,$sec);
   drawhand(21,42,$min);
   drawhand(18,35,5*$hour+$min/12);
   print $buffer;
#}

sub plotchar{
   ($dist,$char,$angle,$stringptr) = @_;
   $x=int(sin($angle*$PIBY30)*$dist);
   $y=(2*int(12-cos($angle*$PIBY30)*$dist/2)+1);
   $pos = $x+$y*40+4;
   substr(${$stringptr}, $pos, 1)=chr($char);
}

sub drawhand{
   ($length,$char,$angle)=@_;
   for(0..$length){
      plotchar($_,$char,$angle,\$buffer);
   }
}

