#include <time.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
time_t current_time;
char* c_time_string;
current_time = time(NULL);
if (current_time == ((time_t)-1))
{
printf("Error in computing current time.");
return 1;
}
c_time_string = ctime(¤t_time);
if (NULL == c_time_string)
{
printf("Error in conversion of current time.");
return 1;
}
printf("Current time is %s", c_time_string);
getch();
return 0;
}1 answer
Best answer
Was this answer helpful?
Thanks for the feedback.
Sign up free to save answers and ask your own doubts
Your answer
Log in or create a free account to answer this question.