# Thread: update screen in 13h mode after a sec,min and hour --(whole number thing)

1. ## update screen in 13h mode after a sec,min and hour --(whole number thing)

Hey
ive got a problem working with 13h mode ::sigh:: i now its old but still a good way to learn very basic graphic things anyway.
Im working on a screensaver...(its supposed to be a clock)
anyway ill post the code and explain my prob
Code:
```int wijzers()
{
struct time t;
float pi=6.2831854,hoek_sec,hoek_min,begin=-1.57079635;
int x,y,r,sec,min,i=1;
while(!kbhit()){
gettime(&t);
sec=t.ti_sec;
min=t.ti_min;

/*SECONDs*/
hoek_sec=0.10471975666666666666666666666667*sec;
for(r=0;r<98;r++){
x=cos(hoek_sec+begin)*r*1.2+160;
y=sin(hoek_sec+begin)*r+100;
setpix(14,x,y);
}
for(r=0;r<98;r++){
x=cos(hoek_sec+begin)*r*1.2+160;
y=sin(hoek_sec+begin)*r+100;
setpix(0,x,y);
}

/*MINUTEs*/
hoek_min=0.10471975666666666666666666666667*min;
for(r=0;r<98;r++){
x=cos(hoek_min+begin)*r*1.2+160;
y=sin(hoek_min+begin)*r+100;
setpix(14,x,y);
}
for(r=0;r<98;r++){
x=cos(hoek_min+begin)*r*1.2+160;
y=sin(hoek_min+begin)*r+100;
setpix(0,x,y);
}

}

return 0;
}```
so this function-and some others- should draw something like a watch. But if you look close at my code ull see that i keep updating the screen with setpix.

Now i want to update the second thing only on a whole second and the minute thing after one minute.Because now the clock keeps updating and updating, thus u get flickering screens,lines,pixels etc...
so actually i need a thing to determine wether a number is a whole number or not.
---thought i saw such a thread be4 :whole number:but couldnt find it with search thing on board--

PS: if its not clear what i just wrote say so because ive got the feeling that my english is kinda sh\$\$ty

::edit::
sry bout the sucky code writing (indentations) guess i still cant work with ctrl-C and ctrl-V

2. You could try something like this:

Code:
```#include <stdio.h>
#include <time.h>
#include <conio.h>

int main()
{
int m=0,s=0;
while(!kbhit())
{
time_t lNow =  time(NULL);
struct tm stTimeStruct = *gmtime(&lNow);

/*SECONDs*/
if(stTimeStruct.tm_sec != s)
{
s = stTimeStruct.tm_sec;
printf("Draw second hand	---> %d\n", s);
}
/*MINUTEs*/
if(stTimeStruct.tm_min != m)
{
m = stTimeStruct.tm_min;
printf("Draw MINUTE hand	======> %d\n", m);
}
}
return 0;
}```

3. hmm cant get yours to work scarlet...
wouldnt it be simpler to.....
im just guessing now actually:
to create a integer array and then check wether
Code:
```gettime(&t);
sec=t.ti_sec;
min=t.ti_min;```
sec and min are somewhere in that array... the only thing i need to now is when i have a full second and when a full minute...
because my cde works fine but the update of the screen has to be per -second-minute-houre.
So i was thinking about checking weather the sec, min and houre are whole numbers. And if i would declare them as a float then theres an exact point where these numbers are whole.