get time in C code example
Example 1: c get time
/* localtime example */
#include
#include
int main ()
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf ( "Current local time and date: %s", asctime (timeinfo) );
return 0;
}
Example 2: function to find system time in c
time_t now = time(0); // Get the system time