Tuesday, May 18, 2010

Real Time Clock (RTC) using C

This weekend while going through some of the forums, i saw a few posts on RTC using C. It's quiet interesting, so i worked on it written the following code.

#include "stdio.h"
#include "dos.h"
#include "conio.h"
#include "stdlib.h"
#include "time.h"
int main(void)
{
time_t now;
time(&now);
while(1)
{
time(&now);
clrscr();

printf("%s", ctime(&now));
sleep(1);
if(kbhit())
{
break;
}
}

return 0;
}

Any Comments and Suggestions?

No comments:

Post a Comment