aUCBLogo Demos and Tests / clock
			
				
			
			be clock [singleshot false][FrameNr 0]
   f=3
   cs ht
   setPenColor 0
   setLabelAlign 0 0
   setLabelSize [60 60]
   setUpdateGraph false
   forever
   [   calibrate
      repeat 60*85
      [   update
         if singleshot [stop]
         if key? [stop]
      ]
   ]
   be calibrate
      thetime=time
      hour=first thetime
      minute=first bf thetime
      sec=first bf bf thetime
      sec0=sec
      while [sec0==sec]
      [   thetime=time
         hour0=first thetime
         minute0=first bf thetime
         sec0=first bf bf thetime
         minute0=minute0+sec0/60
         hour0=hour0+minute0/60
      ]
      t0=timefine
   end
   be update
      t=timefine-calibrate::t0
      hour=calibrate::hour0+t/3600
      minute=calibrate::minute0+t/60
      sec=calibrate::sec0+t
      clearScreen
      drawface
      plottimehour hour
      plottimeminute minute
      plottimesec sec
      if singleshot [stop]
      updateGraph
   end
   be drawface
      setPenSize [2 2]
      setHeading 30
      pu
      repeat 12
      [   fd 100*f
         pd  bk 10*f  pu
         bk 10*f
         sh=heading
         setheading 90
         label repcount
         setheading sh
         bk 80*f
         rt 30
      ]
      repeat 60
      [   fd 100*f
         pd  bk 5*f  pu 
         back 95*f
         rt 6
      ]
   end
   
   be plottimehour hour
      setpensize [10 10]
      setheading hour*30
      pd
      fd 50*f
      pu
      bk 50*f
   end
   
   be plottimeminute minute
      setpensize [4 4]
      setheading minute*6
      pd
      fd 100*f
      pu
      bk 100*f
   end
   
   be plottimesec sec
      setpensize [2 2]
      setheading sec*6
      pd
      fd 100*f
      pu
      bk 100*f
   end
end