int H,CO,CA,X,Y,x,y,i;
int Xs,Ys,Xm,Ym,Xh,Yh;
double temp;
float ho,m,s;
H=200;
x=320;
y=240;
// while(!kbhit())
//{
setfillstyle(1,BLANCO);
fillellipse(x,y,H,H);
setcolor(GRIS);
for(i=1;i<61;i++)
{
if(i >0 && i <=15)
{
temp = (-1 *(i*6-90))/((360/M_PI)/2);
CO = -1 * (H *(sin(temp)));
CA = H * (cos(temp));
}
else if (i >15 && i<=30)
{
temp = (i*6-90)/((360/M_PI)/2);
CO =H * (sin(temp));
CA =H * (cos(temp));
}
else if (i >30 && i<=45)
{
temp = (-1*(i*6-270))/((360/M_PI)/2);
CO = H * (sin(temp));
CA= -1 * (H * (cos(temp)));
}
else if (i >45 && i <=60)
{
temp =(i*6-270)/((360/M_PI)/2);
CO = -1* (H * (sin(temp)));
CA = -1 *(H *(cos(temp)));
}
X= x + CA;
Y = y + CO;
line(x,y,X,Y);
}
setcolor(NEGRO);
for(i=1;i<13;i++)
{
if(i >0 && i <=3)
{
temp = (-1 *(i*30-90))/((360/M_PI)/2);
CO = -1 * (H *(sin(temp)));
CA = H * (cos(temp));
}
else if (i >3 && i<=6)
{
temp = (i*30-90)/((360/M_PI)/2);
CO =H * (sin(temp));
CA =H * (cos(temp));
}
else if (i >6 && i<=9)
{
temp = (-1*(i*30-270))/((360/M_PI)/2);
CO = H * (sin(temp));
CA= -1 * (H * (cos(temp)));
}
else if (i >9 && i <=12)
{
temp =(i*30-270)/((360/M_PI)/2);
CO = -1* (H * (sin(temp)));
CA = -1 *(H *(cos(temp)));
}
X= x + CA;
Y = y + CO;
line(x,y,X,Y);
}
setcolor(BLANCO);
setfillstyle(SOLID_FILL,BLANCO);
fillellipse(x,y,H-(H*0.1),H-(H*0.1));
while(!kbhit())
{
gettime(&h);
setcolor(NEGRO);
if(h.ti_hour > 12)
h.ti_hour = h.ti_hour - 12;
s= h.ti_sec +(float)((float)h.ti_hund / 100);
m = h.ti_min + ((s*100/60)/100);
ho = h.ti_hour + ((m*100/60)/100);
sprintf(es,"%d : %d : %d.%d",h.ti_hour,h.ti_min,h.ti_sec,h.ti_hund);
setfillstyle(SOLID_FILL,GRIS);
bar(100,425,220,450);
outtextxy(100,425,es);
//------->Segundero
setlinestyle(SOLID_LINE,1,1);
setcolor(ROJO);
if(s >0 && s <=15)
{
temp = (-1 *(s*6-90))/((360/M_PI)/2);
CO = -1 * ((H-(H*0.1)) *(sin(temp)));
CA = (H-(H*0.1)) * (cos(temp));
}
else if (s >15 && s<=30)
{
temp = (s*6-90)/((360/M_PI)/2);
CO =(H-(H*0.1)) * (sin(temp));
CA =(H-(H*0.1)) * (cos(temp));
}
else if (s >30 && s<=45)
{
temp = (-1*(s*6-270))/((360/M_PI)/2);
CO = (H-(H*0.1)) * (sin(temp));
CA= -1 * ((H-(H*0.1)) * (cos(temp)));
}
else if (s >45 && s <=60)
{
temp =(s*6-270)/((360/M_PI)/2);
CO = -1* ((H-(H*0.1)) * (sin(temp)));
CA = -1 *((H-(H*0.1)) *(cos(temp)));
}
Xs= x + CA;
Ys = y + CO;
line(x,y,Xs,Ys);
//------> Minutero
setlinestyle(SOLID_LINE,1,2);
setcolor(GRISO);
if(m >0 && i <=15)
{
temp = (-1 *(m*6-90))/((360/M_PI)/2);
CO = -1 * ((H-(H*0.1)) *(sin(temp)));
CA = (H-(H*0.1)) * (cos(temp));
}
else if (m >15 && m<=30)
{
temp = (m*6-90)/((360/M_PI)/2);
CO =(H-(H*0.1)) * (sin(temp));
CA =(H-(H*0.1)) * (cos(temp));
}
else if (m >30 && m<=45)
{
temp = (-1*(m*6-270))/((360/M_PI)/2);
CO = (H-(H*0.1)) * (sin(temp));
CA= -1 * ((H-(H*0.1)) * (cos(temp)));
}
else if (m >45 && m <=60)
{
temp =(m*6-270)/((360/M_PI)/2);
CO = -1* ((H-(H*0.1)) * (sin(temp)));
CA = -1 *((H-(H*0.1)) *(cos(temp)));
}
Xm= x + CA;
Ym = y + CO;
line(x,y,Xm,Ym);
//----------->Hora
setlinestyle(SOLID_LINE,1,3);
setcolor(NEGRO);
if(ho >0 && ho <=3)
{
temp = (-1 *(ho*30-90))/((360/M_PI)/2);
CO = -1 * ((H-(H*0.3)) *(sin(temp)));
CA = (H-(H*0.3)) * (cos(temp));
}
else if (ho >3 && ho<=6)
{
temp = (ho*30-90)/((360/M_PI)/2);
CO =(H-(H*0.3)) * (sin(temp));
CA =(H-(H*0.3)) * (cos(temp));
}
else if (ho >6 && ho<=9)
{
temp = (-1*(ho*30-270))/((360/M_PI)/2);
CO = (H-(H*0.3)) * (sin(temp));
CA= -1 * ((H-(H*0.3)) * (cos(temp)));
}
else if (ho >9 && ho <=12)
{
temp =(ho*30-270)/((360/M_PI)/2);
CO = -1* ((H-(H*0.3)) * (sin(temp)));
CA = -1 *((H-(H*0.3)) *(cos(temp)));
}
Xh= x + CA;
Yh = y + CO;
line(x,y,Xh,Yh);
setcolor(BLANCO);
setlinestyle(SOLID_LINE,1,1);
line(x,y,Xs,Ys);
setlinestyle(SOLID_LINE,1,2);
line(x,y,Xm,Ym);
setlinestyle(SOLID_LINE,1,3);
line(x,y,Xh,Yh);
}