Two version that do exactly the same thing!
Get the current time(according to your system).
#include <stdio.h>
#include <time.h>
char *get_time1()
{
time_t current;
time(¤t);
tm *local = localtime(¤t);
return(asctime(local));
}
char *get_time2()
{
time_t current;
time(¤t);
return(ctime(¤t));
}
int main()
{
printf("%s%s", get_time1(), get_time2());
getchar();
return(0);
}
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.