-
time
this prints the time
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
time_t now;
time(&now);
printf("%s", ctime(&now));
return EXIT_SUCCESS;
}
but it doesnt keep up. So i would like some hints on how to keep the time going. if all possible.
-
Continuos loop were you check and update(display)....
-
maybe something like this:
Code:
time_t now;
time(&now);
while(true)
{
time(&now);
char *sz = ctime(&now);
sz[strlen(sz) - 1] = 0; /* this gets rid of the \n */
printf("\r%s ", sz);
}
-
sz[strlen(sz) - 1] = 0 what does this do? I tried it and it says i need to declare it. and without me really knowing what it does or is, its not gonna help me learn ..chow.
-
haha.. i got it.. thanks..