Hi there
Is there a way to create the clock or show the system clock
and it can also tick as the seconds changes
Thank
Printable View
Hi there
Is there a way to create the clock or show the system clock
and it can also tick as the seconds changes
Thank
You can do it with a windows function.
Look up
If your unfamiliar with windows I can try to help you a little further. Basically the LP before the struct name is a typedef for a pointer to it. You pass the structure and it will fill it in with the appropriate information.Code:VOID GetSystemTime( LPSYSTEMTIME lpSystemTime );
Good Luck.
Code:#include <stdio.h>
#include <string.h>
#include <time.h>
int main(void)
{
time_t now, last = time(&now), end = now + 10;
while ( now < end )
{
if ( last < time(&now) )
{
char *text = ctime(&now), *newline = strchr(text, '\n');
*newline = '\0';
printf("\r%s", text);
fflush(stdout);
last = now;
}
}
return 0;
}