/* a sample program that displays current time. */ #include #include #include int main() { struct tm *ptr; time_t ltime; char str[80]; ltime = time(NULL); /* get current calendar time */ ptr = localtime(<ime); // return time in the form of tm structure strftime(str,80,"It is now %H:%M %p.",ptr); printf("%s\n",str); }