/*You can use this clock by putting my name & the name of Compsci.ca in the credits*/
 
 
var theDateTime, theTime : string
 
var hours, mins, sec : int
 
var hours_txt, mins_txt, sec_txt : string
 
var clockx, clocky : int
 
var digital : string
 
var font : int := Font.New ("serif:20")
 
 
setscreen ("title:Thoughtful's Clock")
 
setscreen ("offscreenonly")
 
setscreen ("graphics:290;300,nobuttonbar")
 
 
clockx := 145
 
clocky := 155
 
 
 
loop
 
    theDateTime := Time.Date
 
 
    theTime := theDateTime (11 .. *)
 
    hours := strint (theTime (1 .. 2))
 
    mins := strint (theTime (4 .. 5))
 
    sec := strint (theTime (7 .. 8))
 
 
 
 
    
 
 
    drawline (clockx, clocky, round (clockx + (95 * cosd ((360 - (sec * 6)) + 90))), round (clocky + (95 * sind (360 - (sec * 6) + 90))), black)
 
    drawline (clockx, clocky, round (clockx + (20 * cosd ((360 - (sec * 6)) + 90 + 180))), round (clocky + (20 * sind (360 - (sec * 6) + 90 + 180))), black)
 
 
    Draw.ThickLine (clockx, clocky, round (clockx + (80 * cosd ((360 - (mins * 6+sec/10)) + 90))), round (clocky + (80 * sind (360 - (mins * 6+sec/10) + 90))), 3, black)
 
    Draw.ThickLine (clockx, clocky, round (clockx + (12 * cosd ((360 - (mins * 6+sec/10)) + 90 + 180))), round (clocky + (12 * sind (360 - (mins * 6+sec/10) + 90 + 180))), 3, black)
 
 
    Draw.ThickLine (clockx, clocky, round (clockx + (40 * cosd ((360 - ((hours * 30 +mins/2))) + 90))), round (clocky + (40 * sind (360 - (hours * 30 +mins/2) + 90))), 3, black)
 
    Draw.ThickLine (clockx, clocky, round (clockx + (12 * cosd ((360 - ((hours * 30 +mins/2))) + 90 + 180))), round (clocky + (12 * sind (360 - (hours * 30 +mins/2) + 90 + 180))), 3, black)
 
 
    if hours > 11 then
 
        hours := hours - 12
 
    else
 
    end if
 
    if hours < 10 then
 
        hours_txt := "0" + intstr (hours)
 
    else
 
        hours_txt := intstr (hours)
 
    end if
 
 
    if mins < 10 then
 
        mins_txt := "0" + intstr (mins)
 
    else
 
        mins_txt := intstr (mins)
 
    end if
 
 
    if sec < 10 then
 
        sec_txt := "0" + intstr (sec)
 
    else
 
        sec_txt := intstr (sec)
 
    end if
 
 
    digital := hours_txt + ":" + mins_txt + ":" + sec_txt
 
    
 
   
 
    drawfillbox(100,0,195,18,black)
 
    Font.Draw (digital, 100, 0, font, white)
 
    drawoval(clockx,clocky,130,130,black)
 
 
    View.Update
 
    cls
 
end loop
 
  |