2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-12-11 11:10:58 +00:00
< meta name = "generator" content = "ZealOS V1.07" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
2021-10-08 07:06:11 +01:00
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
2021-07-03 05:07:57 +01:00
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = "font-family:monospace;font-size:12pt" >
2021-09-17 08:32:51 +01:00
< a name = "l1" > < / a > < span class = cF0 > #< / span > < span class = cF1 > define< / span > < span class = cF0 > USE_JIFFIES < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > < / span > < span class = cF2 > // Set FALSE for less smooth but more accurate time.< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l2" > < / a >
< a name = "l3" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > CLOCK_CENTER < / span > < span class = cFE > 70< / span > < span class = cF0 >
< a name = "l4" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > CLOCK_RADIUS (CLOCK_CENTER-< / span > < span class = cFE > 2< / span > < span class = cF0 > )
< a name = "l5" > < / a >
< a name = "l6" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > SECOND_HAND_LEN CLOCK_RADIUS
< a name = "l7" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > MINUTE_HAND_LEN < / span > < span class = cFE > 8< / span > < span class = cF0 > * CLOCK_RADIUS / < / span > < span class = cFE > 10< / span > < span class = cF0 >
< a name = "l8" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > HOUR_HAND_LEN CLOCK_RADIUS / < / span > < span class = cFE > 2< / span > < span class = cF0 >
< a name = "l9" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l10" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > CLOCK_BASE_COLOR < / span > < span class = cF3 > BLACK< / span > < span class = cF0 >
< a name = "l11" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > SECOND_HAND_COLOR < / span > < span class = cF3 > DKGRAY< / span > < span class = cF0 >
< a name = "l12" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > MINUTE_HAND_COLOR < / span > < span class = cF3 > DKGRAY< / span > < span class = cF0 >
< a name = "l13" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > HOUR_HAND_COLOR < / span > < span class = cF3 > BLACK< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l14" > < / a >
< a name = "l15" > < / a > < / span > < span class = cF2 > // set this either 24 or 12< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l16" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > HOUR_MAX < / span > < span class = cFE > 12< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l17" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l18" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > . < / span > < span class = cFE > 2< / span > < span class = cF0 > *< / span > < span class = cF3 > pi< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l19" > < / a >
< a name = "l20" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l21" > < / a > < / span > < span class = cF2 > //EST NY -> India:< / span > < span class = cF0 > < / span > < span class = cF2 > 9.5< / span > < span class = cF0 >
< a name = "l22" > < / a > < / span > < span class = cF2 > //EST NY -> China:< / span > < span class = cF0 > < / span > < span class = cF2 > 12< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l23" > < / a > < / span > < span class = cF9 > CDate< / span > < span class = cF0 > clock_time_offset = < / span > < span class = cFE > 0< / span > < span class = cF0 > * < / span > < span class = cFE > 60< / span > < span class = cF0 > * < / span > < span class = cFE > 60< / span > < span class = cF0 > * < / span > < span class = cF3 > CDATE_FREQ< / span > < span class = cF0 > ;
< a name = "l24" > < / a >
< a name = "l25" > < / a > < / span > < span class = cF9 > CDateStruct< / span > < span class = cF0 > *ds = < / span > < span class = cF5 > CAlloc< / span > < span class = cF0 > (< / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CDateStruct< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l26" > < / a > < / span > < span class = cF9 > CDate< / span > < span class = cF0 > d = < / span > < span class = cF5 > Now< / span > < span class = cF0 > + clock_time_offset;
< a name = "l27" > < / a > < / span > < span class = cF5 > Date2Struct< / span > < span class = cF0 > (ds, d);
< a name = "l28" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > init_jiff = < / span > < span class = cFB > counts< / span > < span class = cF0 > .jiffies;
< a name = "l29" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > cur_jiff;
< a name = "l30" > < / a > < / span > < span class = cF1 > F64< / span > < span class = cF0 > sec, min, hr;
< a name = "l31" > < / a >
< a name = "l32" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > ClockDrawIt(< / span > < span class = cF9 > CTask< / span > < span class = cF0 > *, < / span > < span class = cF9 > CDC< / span > < span class = cF0 > *dc)
< a name = "l33" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l34" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (USE_JIFFIES)
< a name = "l35" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l36" > < / a > cur_jiff = < / span > < span class = cFB > counts< / span > < span class = cF0 > .jiffies - init_jiff;
< a name = "l37" > < / a > sec = ds-> sec + cur_jiff/< / span > < span class = cFE > 1000< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l38" > < / a > min = ds-> min + cur_jiff/< / span > < span class = cFE > 1000< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > /< / span > < span class = cFE > 60< / span > < span class = cF0 > ;
< a name = "l39" > < / a > hr = (ds-> hour % HOUR_MAX) + cur_jiff/< / span > < span class = cFE > 1000< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > /< / span > < span class = cFE > 60< / span > < span class = cF0 > /< / span > < span class = cFE > 60< / span > < span class = cF0 > ;
< a name = "l40" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l41" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l42" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l43" > < / a > d = < / span > < span class = cF5 > Now< / span > < span class = cF0 > + clock_time_offset;
< a name = "l44" > < / a > < / span > < span class = cF5 > Date2Struct< / span > < span class = cF0 > (ds, d);
< a name = "l45" > < / a > sec = ds-> sec;
< a name = "l46" > < / a > min = ds-> min;
< a name = "l47" > < / a > hr = ds-> hour % HOUR_MAX;
< a name = "l48" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l49" > < / a > < / span > < span class = cF2 > /*< / span > < span class = cF0 >
< a name = "l50" > < / a >
< a name = "l51" > < / a > < / span > < span class = cF2 > public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l52" > < / a > < / span > < span class = cF2 > I64 x2,< / span > < span class = cF0 >
< a name = "l53" > < / a > < / span > < span class = cF2 > I64 y2,< / span > < span class = cF0 >
< a name = "l54" > < / a > < / span > < span class = cF2 > I64 z2, I64 step=1,I64 start=0)< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l55" > < / a > < / span > < span class = cF2 > */< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l56" > < / a > < / span > < span class = cF2 > //draw second hand< / span > < span class = cF0 >
< a name = "l57" > < / a > dc-> thick = < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l58" > < / a > dc-> color = SECOND_HAND_COLOR;
< a name = "l59" > < / a > < / span > < span class = cF5 > GrLine3< / span > < span class = cF0 > (dc, CLOCK_CENTER, CLOCK_CENTER, < / span > < span class = cF3 > GR_Z_ALL< / span > < span class = cF0 > ,
< a name = "l60" > < / a > < / span > < span class = cF7 > (< / span > < span class = cF0 > CLOCK_CENTER + SECOND_HAND_LEN * < / span > < span class = cF5 > Cos< / span > < span class = cF0 > (< / span > < span class = cFE > 3< / span > < span class = cF0 > *./< / span > < span class = cFE > 4< / span > < span class = cF0 > + sec * ./< / span > < span class = cFE > 60< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > ,
< a name = "l61" > < / a > < / span > < span class = cF7 > (< / span > < span class = cF0 > CLOCK_CENTER + SECOND_HAND_LEN * < / span > < span class = cF5 > Sin< / span > < span class = cF0 > (< / span > < span class = cFE > 3< / span > < span class = cF0 > *./< / span > < span class = cFE > 4< / span > < span class = cF0 > + sec * ./< / span > < span class = cFE > 60< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > ,
< a name = "l62" > < / a > < / span > < span class = cF3 > GR_Z_ALL< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l63" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l64" > < / a > < / span > < span class = cF2 > // draw minute hand< / span > < span class = cF0 >
< a name = "l65" > < / a > dc-> thick = < / span > < span class = cFE > 2< / span > < span class = cF0 > ;
< a name = "l66" > < / a > dc-> color = MINUTE_HAND_COLOR;
< a name = "l67" > < / a > < / span > < span class = cF5 > GrLine3< / span > < span class = cF0 > (dc, CLOCK_CENTER, CLOCK_CENTER, < / span > < span class = cF3 > GR_Z_ALL< / span > < span class = cF0 > ,
< a name = "l68" > < / a > < / span > < span class = cF7 > (< / span > < span class = cF0 > CLOCK_CENTER + MINUTE_HAND_LEN * < / span > < span class = cF5 > Cos< / span > < span class = cF0 > (< / span > < span class = cFE > 3< / span > < span class = cF0 > *./< / span > < span class = cFE > 4< / span > < span class = cF0 > + min * ./< / span > < span class = cFE > 60< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > ,
< a name = "l69" > < / a > < / span > < span class = cF7 > (< / span > < span class = cF0 > CLOCK_CENTER + MINUTE_HAND_LEN * < / span > < span class = cF5 > Sin< / span > < span class = cF0 > (< / span > < span class = cFE > 3< / span > < span class = cF0 > *./< / span > < span class = cFE > 4< / span > < span class = cF0 > + min * ./< / span > < span class = cFE > 60< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > ,
< a name = "l70" > < / a > < / span > < span class = cF3 > GR_Z_ALL< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l71" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l72" > < / a > < / span > < span class = cF2 > // draw hour hand< / span > < span class = cF0 >
< a name = "l73" > < / a > dc-> thick = < / span > < span class = cFE > 3< / span > < span class = cF0 > ;
< a name = "l74" > < / a > dc-> color = HOUR_HAND_COLOR;
< a name = "l75" > < / a > < / span > < span class = cF5 > GrLine3< / span > < span class = cF0 > (dc, CLOCK_CENTER, CLOCK_CENTER, < / span > < span class = cF3 > GR_Z_ALL< / span > < span class = cF0 > ,
< a name = "l76" > < / a > < / span > < span class = cF7 > (< / span > < span class = cF0 > CLOCK_CENTER + HOUR_HAND_LEN * < / span > < span class = cF5 > Cos< / span > < span class = cF0 > (< / span > < span class = cFE > 3< / span > < span class = cF0 > *./< / span > < span class = cFE > 4< / span > < span class = cF0 > + hr * ./HOUR_MAX)< / span > < span class = cF7 > )< / span > < span class = cF0 > ,
< a name = "l77" > < / a > < / span > < span class = cF7 > (< / span > < span class = cF0 > CLOCK_CENTER + HOUR_HAND_LEN * < / span > < span class = cF5 > Sin< / span > < span class = cF0 > (< / span > < span class = cFE > 3< / span > < span class = cF0 > *./< / span > < span class = cFE > 4< / span > < span class = cF0 > + hr * ./HOUR_MAX)< / span > < span class = cF7 > )< / span > < span class = cF0 > ,
< a name = "l78" > < / a > < / span > < span class = cF3 > GR_Z_ALL< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l79" > < / a >
< a name = "l80" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l81" > < / a > dc-> color = CLOCK_BASE_COLOR;
< a name = "l82" > < / a > < / span > < span class = cF2 > //GrPrint(dc, 0, 0, " %d" , ds-> sec);< / span > < span class = cF0 >
< a name = "l83" > < / a >
< a name = "l84" > < / a > < / span > < span class = cF2 > //draw clock base< / span > < span class = cF0 >
< a name = "l85" > < / a > < / span > < span class = cF5 > GrCircle< / span > < span class = cF0 > (dc, CLOCK_CENTER, CLOCK_CENTER, CLOCK_RADIUS);
2021-07-03 05:07:57 +01:00
< a name = "l86" > < / a >
< a name = "l87" > < / a > }
< a name = "l88" > < / a >
< a name = "l89" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > ClockDemo()
< a name = "l90" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l91" > < / a > < / span > < span class = cF5 > SettingsPush< / span > < span class = cF0 > ;
< a name = "l92" > < / a > < / span > < span class = cF5 > DocClear< / span > < span class = cF0 > ;
< a name = "l93" > < / a > < / span > < span class = cF5 > DocCursor< / span > < span class = cF0 > ;
< a name = "l94" > < / a > < / span > < span class = cF5 > Fs< / span > < span class = cF0 > -> draw_it = & ClockDrawIt;
< a name = "l95" > < / a > < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (< / span > < span class = cF5 > Fs< / span > < span class = cF0 > -> task_title, < / span > < span class = cF6 > " Time" < / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l96" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l97" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF5 > CharGet< / span > < span class = cF7 > (< / span > < span class = cF0 > ,< / span > < span class = cF3 > FALSE< / span > < span class = cF7 > )< / span > < span class = cF0 > != < / span > < span class = cF3 > CH_SHIFT_ESC< / span > < span class = cF0 > ) < / span > < span class = cF7 > {}< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l98" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l99" > < / a > < / span > < span class = cF5 > SettingsPop< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l100" > < / a > };
< a name = "l101" > < / a >
< a name = "l102" > < / a > ClockDemo;
< / span > < / pre > < / body >
< / html >