954,479 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Get the current time(according to your system).

0
By Ivan C on May 29th, 2009 2:46 am

Two version that do exactly the same thing!

#include <stdio.h>
#include <time.h>

char *get_time1()
{
    time_t   current;
    time(&current);
    tm *local = localtime(&current);
    return(asctime(local));
}

char *get_time2()
{
    time_t   current;
    time(&current);
    return(ctime(&current));
}

int main()
{
    printf("%s%s", get_time1(), get_time2());

    getchar();
    return(0);
}

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You