----------------------------------- thoughtful Tue Oct 28, 2003 8:01 pm Analog Digital Clock Source ----------------------------------- Here the code for the analog & digital clock posted in the submission. I thought it would be good to give off the code as this is not a project i am going to submit. /*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 ----------------------------------- Dan Wed Oct 29, 2003 11:06 pm ----------------------------------- very cool, one of the best clock progames i have seen made in turing. (out the hole 3 that i know of :P ) have some bits ----------------------------------- djlenny_3000 Mon Mar 08, 2004 8:57 pm ----------------------------------- can u guys help me out i keep getting an error on the clock programs i can't even use date and time it says: left bound of substring exceeds right bound by more than 1 i constantly keep running into this problem HELP ME PLZ!!! :doh: ----------------------------------- jonos Mon Mar 08, 2004 10:19 pm ----------------------------------- you should probably update your turing, yorus may not have the ability for what thoughtul is using. anyways, nice prog thoughful, really cool and nice looking. ----------------------------------- apomb Tue Mar 09, 2004 6:12 pm ----------------------------------- jonos and dj ... you know this thread is like 5 months old eh? any way, nice prog ... if you even look at this again thoughtful :? ----------------------------------- TheFerret Tue Mar 09, 2004 6:57 pm ----------------------------------- Very good... +10 Bits